shh particles.js - such colors, much wow

shh global variables

windoge.mX = 0

windoge.mY = 0

windoge.particles is []

windoge.maxParticles = 500

windoge.gravity = [1,1]

windoge.isMouseTracked is false

windoge.canvas is plz dogeument.getElementById with "particles"

windoge.context is plz canvas.getContext with '2d'

windoge.cursor is new Image

cursor.src is 'img/cursor.png'

plz animloop

such genParticles

rly windoge.particles.length smaller windoge.maxParticles

much very i as 0 next i smaller 2 next i more 1

very rndC is plz getRandomColor

very rndVec is plz getRandomVector with -4 10

rndVec is plz addVector with rndVec [2,10]

very p is new Particle with [mX,mY] rndC rndVec

plz windoge.particles.push with p

wow

wow

wow

such render

plz context.clearRect with 0 0 canvas.width canvas.height

context.fillStyle is "#000000"

plz context.fillRect with 0 0 canvas.width canvas.height

much very i as 0 next i smaller particles.length next i more 1

context.fillStyle is particles[i].color

plz context.fillRect with particles[i].vec[0] particles[i].vec[1] 2 5

wow

rly cursor.complete and windoge.isMouseTracked

plz context.drawImage with cursor mX-12 mY-12

wow

plz moveParticles

wow

such moveParticles

much very i as 0 next i smaller particles.length next i more 1

very vec is particles[i]

vec.vec is plz addVector with vec.vec windoge.gravity

vec.vec is plz addVector with vec.vec vec.randomVelocity

rly vec.vec[1] > windoge.canvas.height

plz windoge.particles.remove with i

wow

wow

wow

such animloop

plz windoge.requestAnimFrame with animloop

plz render

wow

such mouseoverCall much event

windoge.isMouseTracked is true

wow

such mouseleaveCall much event

windoge.isMouseTracked is false

wow

such mousemoveCall much event

rly isMouseTracked

very boundingRect is plz windoge.canvas.getBoundingClientRect

windoge.mX is event.clientX - boundingRect.left

windoge.mY is event.clientY - boundingRect.top

plz genParticles

wow

wow

such getRandomColor shh very random, much thanks http://www.paulirish.com/2009/random-hex-color-code-snippets/

very color is plz Math.floor with Math.random()*16777215

color is plz color.toString with 16

wow "#"+color

such getRandomVector much x y

very xr is plz Math.floor with Math.random()*x

very xy is plz Math.floor with Math.random()*y

wow [xr,xy]

such addVector much vec1 vec2

very vec = []

vec[0] is vec1[0] + vec2[0]

vec[1] is vec1[1] + vec2[1]

wow vec

such Particle much vec color randomVelocity

this.vec is vec

this.color is color

this.randomVelocity is randomVelocity

wow

plz canvas.addEventListener with 'mouseover' mouseoverCall

plz canvas.addEventListener with 'mouseleave' mouseleaveCall