• Stars
    star
    366
  • Rank 116,084 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 12 years ago
  • Updated almost 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

CSS 3D renderer for Three.js.

CSS3D.js

by Steven Wittens

CSS 3D renderer

CSS 3D renderer for Three.js

Note: this library is mostly obsolete now that Three.js has its own CSS 3D renderer which is integrated in a cleaner fashion.

This experimental renderer was built for the design of Acko.net. It lets you manage simple CSS 3D objects using Three.js.

Functionality is very limited: only planes and lines are supported (THREE.Line, THREE.PlaneGeometry). In its current form it is nowhere near a replacement for WebGL or Canvas, and browser support is buggy at best.

However, in the right setting, CSS 3D can be a useful and impressive effect, particularly when combined with parallax scrolling. I think it shows that there is a case to be made to integrate 3D more tightly into the DOM, with arbitrary meshes and shaders. In the meantime, this library opens the door for more complicated experimentation and prototyping of 3D Web UI concepts.

I don't intend to maintain or develop this further, so forking is encouraged.

Requires: jQuery

Browser support

Currently, it only works in Chrome and Safari. Firefox doesn't seem to reliably support the necessary cascading of preserve-3d transforms.

Usage

Initialize the renderer like any other Three.js renderer, using:

var renderer = new Acko.CSS3DRenderer({
  perspective: ... // optional
});

By default, the renderer wraps itself in a CSS perspective for the camera. Use perspective to specify a custom DOM element which will receive the camera's CSS perspective instead. You can use this to link the renderer to a page-wide parallax effect. Or, specify 'false' to forego camera perspective and hardcode it yourself.

To nest the CSS 3D renderer, make sure you apply transform-style: preserve-3d as necessary.

The file css3d.css contains useful default styles.

Editor

A simple keyboard operator editor is included in editor.html. The scene is serialized into the textfield at the bottom. Copy/paste this into data.js to save it.

Controls

  • Click+Drag β€” Orbit camera
  • Enter β€” New object
  • Space β€” Clone object
  • Backspace β€” Delete object
  • Tab / Shift+Tab β€” Cycle through objects
  • WASD/QE β€” Move object
  • Shift+WASD/QE β€” Resize object
  • Ctrl+WASD/QE β€” Move camera
  • [] β€” Lower/raise units
  • ZX β€” Orbit distance
  • T/T/U β€” Tag/untag/untag all

The scene editor was developed specifically for Acko.net and lacks many features (like custom colors). Colors are hardcoded in serialize.js.

Β© 2012 Steven Wittens - MIT License.

More Repositories

1

TermKit

Experimental Terminal platform built on WebKit + node.js. Currently only for Mac and Windows, though the prototype works 90% in any WebKit browser.
JavaScript
4,434
star
2

MathBox.js

MathBox is a (work in progress) library for making presentation-quality math diagrams in WebGL.
JavaScript
1,941
star
3

mathbox

Presentation-quality WebGL math graphing
JavaScript
1,299
star
4

shadergraph

Functional GLSL Linker
JavaScript
719
star
5

ThreeAudio.js

ThreeAudio helps you create music visualizations in Three.js or tQuery.
JavaScript
529
star
6

fullfrontal

MathBox-based conference talks
JavaScript
338
star
7

fuse10

Front-end for Acko.net 2013
JavaScript
246
star
8

threestrap

Minimal Three.js Bootstrapper
JavaScript
237
star
9

console-extras.js

Enhancements to the JavaScript console object.
JavaScript
127
star
10

ShaderGraph.js

(deprecated) Library to build GLSL shaders out of reusable building blocks.
JavaScript
123
star
11

NFSpace

Procedural planet generator
C
122
star
12

ThreeRTT.js

ThreeRTT helps you create advanced render-to-texture effects in Three.js.
JavaScript
73
star
13

NeverSeenTheSky

Source code for the WebGL demo Never Seen The Sky
JavaScript
54
star
14

iremotepipe

Command-line tool that streams button presses from Apple IR remotes on OS X.
Objective-C
48
star
15

imgui-wgpu-rs

Dear imgui renderer for wgpu-rs.
Rust
29
star
16

DarkSunrise

Music visualizer demo for Christmas Experiments 2013
JavaScript
26
star
17

ThreeBox.js

(dead) ThreeBox provides an improved boilerplate set up for tQuery / Three.js.
JavaScript
23
star
18

jsFsck

Makes Douglas Crockford cry and gives JavaScript debuggers nightmares.
JavaScript
21
star
19

headspace

TypeScript
12
star
20

pixelfactory

MathBox2-based talk about Pixels, MathBox and GPUs.
JavaScript
12
star
21

WikiTLDR

Chrome/Safari Extension. Reformats WikiLeaks cables for readability.
JavaScript
11
star
22

uncolorblind

Uncolor blindness goggles (Web / JS / GLSL)
JavaScript
11
star
23

vscode-headspace

Headspace audio VSCode plugin
JavaScript
4
star