DIR : /home/kozerus/public_html/jkwii/js/jsdoit/Sphere/index.js

/home/kozerus/public_html/jkwii/js/jsdoit/Sphere

var canvas = document.body.appendChild( document.createElement( 'canvas' ) ),
    context = canvas.getContext( '2d' ),
    t = 0;

window.addEventListener( 'resize', resize, false );

resize();
animate();

function resize() {
    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight;
}

function animate() {
    context.clearRect( 0, 0, canvas.width, canvas.height );
    context.globalCompositeOperation = 'lighter';
    
    t += 0.1;
    
    for( var i = 0; i < 10000; i++ ) {
        var f = 0.05 + ( ( Math.sin(t*0.00002) / Math.PI ) * 0.2 );        
        var r = ( ( canvas.width + canvas.height ) / 2 ) * ( Math.cos( (t+i)*f ) / Math.PI * 1.5 );
        
        var x = Math.sin(i) * r + (canvas.width/2);
        var y = Math.cos(i) * r + (canvas.height/2);
        
        context.fillStyle = 'rgba(0,255,255,0.5)';
        context.fillRect( x, y, 1.5, 1.5 );        
    }
    
    setTimeout( animate, 16 ); // Sans rAF out of laziness
}
//


koh5_pano



Your browser does not support the HTML5 canvas element.


Drag mouse to navigate.

Navigation





17.Aug.2010, Martin Wengenmayer