-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Seb Lee-Delisle <[email protected]>
- Loading branch information
1 parent
83eb31b
commit af4f1fe
Showing
47 changed files
with
251 additions
and
28 deletions.
There are no files selected for viewing
Binary file not shown.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
|