1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <!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%;
- }
- a { color: #00ffff; }
- </style>
- </head>
- <body>
- <div class="info">
- <a href="http://threejs.org" target="_blank" rel="noopener">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.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 src="js/utils/BufferGeometryUtils.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 );
- container.appendChild( renderer.domElement );
- stats = new Stats();
- container.appendChild( stats.dom );
- var sceneA = new Scene( "cube", 5000, 1200, 120, new THREE.Vector3( 0, - 0.4, 0 ), 0xffffff );
- var 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>
|