forked from xeolabs/scenejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
177 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>SceneJS First Example</title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | ||
|
||
<style> | ||
body { | ||
margin: 0; | ||
-moz-user-select: -moz-none; | ||
-khtml-user-select: none; | ||
-webkit-user-select: none; | ||
} | ||
</style> | ||
|
||
<script src="./scenejs.js"></script> | ||
|
||
</head> | ||
<body> | ||
|
||
<script> | ||
|
||
//------------------------------------------------------------------------------------------------------------------ | ||
// A SceneJS minimal boilerplate to get you started | ||
// | ||
// Some resources you might need: | ||
// | ||
// Getting started: http://xeolabs.com/articles/scenejs-quick-start/ | ||
// Examples: http://scenejs.org/examples/index.html | ||
// Tutorials: http://xeolabs.com | ||
// | ||
// Right, off you go - make something wicked! | ||
//------------------------------------------------------------------------------------------------------------------ | ||
|
||
|
||
// Point SceneJS to the bundled plugins | ||
SceneJS.setConfigs({ | ||
pluginPath:"./plugins" | ||
}); | ||
|
||
|
||
// Define scene | ||
var scene = SceneJS.createScene({ | ||
nodes:[ | ||
{ | ||
type:"lookAt", | ||
eye:{ y:5, z:7 }, | ||
look:{ x:0, y:1, z:0 }, | ||
|
||
nodes:[ | ||
{ | ||
type:"material", | ||
color:{ r:0.3, g:0.3, b:1.0 }, | ||
|
||
nodes:[ | ||
{ | ||
type:"rotate", | ||
id:"myRotate", | ||
y:1.0, | ||
angle:0, | ||
|
||
nodes:[ | ||
|
||
// Teapot primitive, implemented by plugin at | ||
// http://scenejs.org/api/latest/plugins/node/geometry/teapot.js | ||
{ | ||
type:"geometry/teapot" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}); | ||
|
||
|
||
// On each frame, spin the teapot a little bit | ||
scene.getNode("myRotate", | ||
function (myRotate) { | ||
|
||
var angle = 0; | ||
|
||
scene.on("tick", | ||
function () { | ||
myRotate.setAngle(angle += 0.5); | ||
}); | ||
}); | ||
|
||
</script> | ||
</body> | ||
</html> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ | |
yaw:30, | ||
pitch:-30, | ||
zoom:15, | ||
zoomSensitivity:10.0, | ||
zoomSensitivity:2.0, | ||
|
||
nodes:[ | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>SceneJS Example</title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | ||
|
||
<style> | ||
body { | ||
background: white; | ||
margin: 0; | ||
-moz-user-select: -moz-none; | ||
-khtml-user-select: none; | ||
-webkit-user-select: none; | ||
} | ||
</style> | ||
|
||
<script src="../api/latest/scenejs.js"></script> | ||
<link href="css/styles.css" rel="stylesheet"/> | ||
|
||
<body> | ||
|
||
<div id="infoDark"> | ||
<a href="http://scenejs.org">SceneJS</a> - <a href="../api/latest/plugins/node/geometry/quad.js" target="_other">quad</a> | ||
geometry | ||
</div> | ||
|
||
<script> | ||
|
||
// Point SceneJS to the bundled plugins | ||
SceneJS.setConfigs({ | ||
pluginPath: "../api/latest/plugins" | ||
}); | ||
|
||
// Create scene | ||
SceneJS.createScene({ | ||
nodes: [ | ||
|
||
// Mouse-orbited camera, implemented by plugin at | ||
// http://scenejs.org/api/latest/plugins/node/cameras/orbit.js | ||
{ | ||
type: "cameras/orbit", | ||
yaw: 30, | ||
pitch: -30, | ||
zoom: 30, | ||
zoomSensitivity: 2.0, | ||
|
||
nodes: [ | ||
{ | ||
type: "material", | ||
color: { r: 0.6, g: 0.6, b: 0.9 }, | ||
nodes: [ | ||
|
||
{ | ||
type: "scale", | ||
x: 10, y: 10, z: 10, | ||
|
||
nodes: [ | ||
|
||
// Quad primitive, implemented by plugin at | ||
// http://scenejs.org/api/latest/plugins/node/geometry/quad.js | ||
// TODO: support size properties like 'geometry/plane' | ||
{ | ||
type: "geometry/quad" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}); | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters