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
Drag mouse to navigate.
Navigation
- Left/Right Mouse drag: Changes camera heading.
- Up/Sown Mouse drag: Changes camera pitch.
- Scroll wheel: Changes camera field of view.
- I-Key: Displays Info panel with canvas size, image size and FPS.
17.Aug.2010, Martin Wengenmayer