Skip to content

Commit

Permalink
Dutch PHP conference particles
Browse files Browse the repository at this point in the history
Signed-off-by: Seb Lee-Delisle <[email protected]>
  • Loading branch information
sebleedelisle committed Jun 28, 2014
1 parent 6da5527 commit 835f512
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions 2014/DutchPHP.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!DOCTYPE HTML>
<html lang="en">
<meta charset="utf-8">
<head>
<title> Particles!</title>
<style type="text/css">
body {
background-color:black;
margin:0px;
overflow : hidden;
}
</style>
</head>

<body>

<script>

var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');

document.body.appendChild(canvas);
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

var particles = [];

setInterval(loop, 1000/40);

function loop() {

ctx.clearRect(0,0,canvas.width, canvas.height);

var p = { x : canvas.width/2, y:canvas.height/2,
xVel:Math.random()*10 -5, yVel:Math.random()*10 -5,
size : 10 };
particles.push(p);


for(var i = 0; i<particles.length; i++) {
var p = particles[i];
ctx.fillStyle = 'orange';
ctx.fillRect(p.x,p.y,p.size,p.size);

p.x += p.xVel;
p.y += p.yVel;
p.xVel*=0.98;
p.yVel*=0.98;
p.yVel+=0.5;
p.size*=0.96;
}
}




</script>
</body>


</html>















0 comments on commit 835f512

Please sign in to comment.