2012年5月24日 星期四

HTML 5 - canvas - Part IX


Introduction
Three.js含有與3D效果有關的物件

Note



Usage
window.requestAnimFrame = (function(callback)
{
    return window.requestAnimationFrame ||
    window.webkitRequestAnimationFrame ||
    window.mozRequestAnimationFrame ||
    window.oRequestAnimationFrame ||
    window.msRequestAnimationFrame ||
    function(callback)
    {
        window.setTimeout(callback, 1000 / 60);
        };
    })();
 
// Draw the frame
function animate(lastTime, angularSpeed, three)
{
    // update
    
    // render
    three.renderer.render(three.scene, three.camera);

    // request new frame
    requestAnimFrame(function(){
        animate(lastTime, angularSpeed, three);
    });
}

window.onload = function()
{  
    // Initial the renderer
 
    // camera
         
    // scene
 
    // shape

    // Add the shape to the scene
 
    // create wrapper object that contains three.js objects
    var three = {
        renderer: renderer,
        camera: camera,
        scene: scene,
        plane: plane
    };
 
    animate(lastTime, angularSpeed, three);
};

Reference: HTML5 Tutorial

沒有留言:

張貼留言