Skip to content

Instantly share code, notes, and snippets.

Created June 20, 2013 02:25
Show Gist options
  • Save anonymous/5819875 to your computer and use it in GitHub Desktop.
Save anonymous/5819875 to your computer and use it in GitHub Desktop.
YUI().use('y3d-scene', 'y3d-camera', 'y3d-geometry-box', function(Y) {
var scene = new Y.Scene({
camera: new Y.Camera({
z: 20
}),
background: '#272822'
});
var box = new Y.Box({
color: '#ff7700'
});
scene.add(box);
scene.render();
controls.render();
controls.color.onChange(function(value) {
box.set('color', value);
scene.render();
});
var x = y = z = 0;
controls.rotation.x.onChange(function(value) {
box.rotate('x', value - x);
scene.render();
x = value;
});
controls.rotation.y.onChange(function(value) {
box.rotate('y', value - y);
scene.render();
y = value;
});
controls.rotation.z.onChange(function(value) {
box.rotate('z', value - z);
scene.render();
z = value;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment