Skip to content

Commit

Permalink
Reorganising and adding WXG files
Browse files Browse the repository at this point in the history
Signed-off-by: Seb Lee-Delisle <[email protected]>
  • Loading branch information
sebleedelisle committed Oct 13, 2012
1 parent 83eb31b commit af4f1fe
Show file tree
Hide file tree
Showing 47 changed files with 251 additions and 28 deletions.
Binary file removed .DS_Store
Binary file not shown.
Binary file removed 1_Particles/.DS_Store
Binary file not shown.
28 changes: 0 additions & 28 deletions 1_Particles/Particles0.html

This file was deleted.

File renamed without changes.
76 changes: 76 additions & 0 deletions 2011/1_Particles/Particles0.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>@seb_ly</title>
<style type="text/css">
body {
margin : 0px;
background : black;
overflow : hidden;
}

</style>
</head>
<body>

<script>

var canvas = document.createElement('canvas');
var c = canvas.getContext('2d');
document.body.appendChild(canvas);
var width = canvas.width = window.innerWidth;
var height = canvas.height = window.innerHeight;

var particles = new Array() ;



setInterval(loop, 1000/30);

function loop() {

c.clearRect(0, 0, width, height);

var particle = new Particle();
particles.push(particle);

for(var i = 0; i< particles.length;i++) {
particles[i].update();
}

while(particles.length>20) {
particles.shift();
}

}


function Particle() {

this.x = width/2;
this.y = height/2;
this.velX = Math.random() * 20 - 10;
this.velY = Math.random() * 20 - 10;
this.size = Math.random() * 10;

this.update = function () {

this.x+=this.velX;
this.y+=this.velY;

c.fillStyle = '#ff6600';

c.beginPath();
c.arc(this.x, this.y, this.size, 0, Math.PI*2, true);
c.fill();
this.size *=0.9;
this.velY+=1;

};

}

</script>
</body>
</html>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed libs/.DS_Store
Binary file not shown.
72 changes: 72 additions & 0 deletions wxg/designer-track.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<!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>

<canvas width=800 height=600 id='mycanvas'></canvas>

<script>

var canvas = document.getElementById('mycanvas');
var c = canvas.getContext('2d');

var particles = [];


setInterval(loop, 1000/60);

function loop() {

//c.clearRect(0,0,800,600);
c.fillStyle = 'rgba(0,0,0,0.1)';
c.fillRect(0,0,800,600);

var p = {

x : 400,
y : 300,
xSpeed : Math.random() * 10 -5,
ySpeed : Math.random() * 10 -5,
colour : 'hsl('+ Math.random()*50 +',100%,50%)',
size : Math.random()*10


}

particles.push(p);

if(particles.length>200) particles.shift();

for(var i = 0; i<particles.length; i++) {
var p = particles[i];
c.fillStyle = p.colour ;


c.beginPath();
c.arc(p.x,p.y,p.size,0,Math.PI*2, true);
c.fill();

p.size*=0.96;
p.x += p.xSpeed;
p.y += p.ySpeed;
p.ySpeed+=0.2;
}
}

</script>
</body>


</html>

103 changes: 103 additions & 0 deletions wxg/developer-track.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<!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');
document.body.appendChild(canvas);
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var c = canvas.getContext('2d');

var particles = [];

setInterval(draw, 1000/30);

function draw() {

//c.clearRect(0,0,canvas.width, canvas.height);

c.fillStyle = 'rgba(0,0,0,0.05)';
c.fillRect(0,0,canvas.width, canvas.height);
c.save();
c.translate(canvas.width/2, canvas.height/2);

var p = new Particle();
particles.push(p);

while(particles.length>200) particles.shift();

for(var i = 0; i<particles.length; i++) {

p = particles[i];

c.fillStyle = p.colour;

var fov = 250;
var scale = fov/(p.z+fov);
var x2d = p.x * scale;
var y2d = p.y * scale;


c.fillRect(x2d,y2d,scale, scale);

// p.size*=1.05;
//
// var drag = 1.05;
//
// p.xVel *= drag;
// p.yVel *= drag;
//
// // p.yVel +=0.5;

//p.x+=p.xVel;
//p.y+=p.yVel;
p.z -= 5;

if(p.z < -fov) p.z += (fov*2);

}
c.restore();
}

function Particle() {

this.x = random(-400,400);
this.y = random(-400,400);
this.z = 0;

// this.xVel =random(-15,15);
// this.yVel =random(-15,15);
this.size = 2;

this.colour = 'white';//'hsl('+random(180,220)+', 100%, 50%)';



}


function random(min, max) {

return Math.random() * (max-min) + min;

}

</script>
</body>


</html>

0 comments on commit af4f1fe

Please sign in to comment.