mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 19:43:48 +01:00
100 lines
2.2 KiB
HTML
Executable File
100 lines
2.2 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>three.js webgl - scenes transition</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 {
|
|
font-family: Monospace;
|
|
background-color: #f0f0f0;
|
|
margin: 0px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.info {
|
|
position: absolute;
|
|
background-color: black;
|
|
opacity: 0.8;
|
|
color: white;
|
|
text-align: center;
|
|
top: 0px;
|
|
width: 100%;
|
|
}
|
|
|
|
.info a {
|
|
color: #00ffff;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="info">
|
|
<a href="http://threejs.org" target="_blank">three.js</a> webgl scene transitions - by <a href="https://twitter.com/fernandojsg">fernandojsg</a> - <a href="https://github.com/kile/three.js-demos">github</a>
|
|
</div>
|
|
|
|
<div id="container"></div>
|
|
|
|
<script src="../build/three.min.js"></script>
|
|
<script src="js/libs/stats.min.js"></script>
|
|
<script src="js/libs/dat.gui.min.js"></script>
|
|
<script src="js/crossfade/scenes.js"></script>
|
|
<script src="js/crossfade/gui.js"></script>
|
|
<script src="js/crossfade/transition.js"></script>
|
|
|
|
<script>
|
|
|
|
var container, stats;
|
|
var renderer;
|
|
var transition;
|
|
|
|
var clock = new THREE.Clock();
|
|
|
|
init();
|
|
animate();
|
|
|
|
function init() {
|
|
|
|
initGUI();
|
|
|
|
container = document.getElementById( "container" );
|
|
|
|
renderer = new THREE.WebGLRenderer( { antialias: true } );
|
|
renderer.setPixelRatio( window.devicePixelRatio );
|
|
renderer.setSize( window.innerWidth, window.innerHeight );
|
|
renderer.sortObjects = false;
|
|
container.appendChild( renderer.domElement );
|
|
|
|
stats = new Stats();
|
|
stats.domElement.style.position = 'absolute';
|
|
stats.domElement.style.top = '0px';
|
|
container.appendChild( stats.domElement );
|
|
|
|
sceneA = new Scene( "cube", 5000, 1200, 120, new THREE.Vector3(0,-0.4,0), 0xffffff );
|
|
sceneB = new Scene( "sphere", 500, 2000, 50, new THREE.Vector3(0,0.2,0.1), 0x000000 );
|
|
|
|
transition = new Transition(sceneA,sceneB);
|
|
|
|
}
|
|
|
|
function animate() {
|
|
|
|
requestAnimationFrame( animate );
|
|
|
|
render();
|
|
stats.update();
|
|
|
|
}
|
|
|
|
function render() {
|
|
|
|
transition.render( clock.getDelta() );
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|