Ajax Loader
JavaScript
x
32
1
 
2
var d = document,
3
    canvas = d.body.appendChild( d.createElement( 'canvas' ) ),
4
    context = canvas.getContext( '2d' ),
5
    time = 0,
6
    w = canvas.width = innerWidth,
7
    h = canvas.height = innerHeight,
8
    m = Math,
9
    cos = m.cos,
10
    sin = m.sin,
11
    PI = m.PI
12
 
13
// The main animation loop
14
setInterval( function() {
15
    // Clear
16
    canvas.width = canvas.width;
17
 
18
    time += .1;
19
 
20
    // The number of particles to generate
21
    i = 10000
22
 
23
    while( i-- ) {
24
        // The magic
25
        r =  (w+h)/2 * ( cos( ( time + i ) * ( .05 + ( sin(time/100000) / PI  * .2 ) ) ) / PI )
26
 
27
        context.fillRect( sin(i) * r + w/2,
28
                          cos(i) * r + h/2,
29
                          1.5,
30
                          1.5 )
31
    }
32
}, 16 )
 

Impressive Sphere animation in 317 bytes by Hakim

CSSDeck G+