A Pen by Peter Briers on CodePen.
Created
April 19, 2016 20:18
-
-
Save peebeebee/f03753b14d229c3c1d3ca76dad082b37 to your computer and use it in GitHub Desktop.
Canvas Experiments 006
This file contains hidden or 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
div#frame | |
canvas#cv |
This file contains hidden or 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
"use strict"; | |
console.clear(); | |
let cv, ctx, fps, mouse; | |
class Position { | |
constructor(coords) { | |
this.coords = []; | |
for(let i = 0; i < coords.length; i++) { | |
this.coords.push(coords[i]); | |
} | |
console.log(this.coords); | |
} | |
static lerp(a, b, t) { | |
var len = a.length; | |
if(b.length != len) return; | |
var x = []; | |
for(var i = 0; i < len; i++) { | |
x.push(a[i] + t * (b[i] - a[i])); | |
} | |
return x; | |
} | |
getCoord() { | |
return [ | |
Math.random()*cv.width, | |
Math.random()*cv.height | |
]; | |
} | |
} | |
class Particle { | |
constructor() { | |
this.posStart = new Position(1, 2, 4); | |
this.posEnd = new Position(3, 6, 5, 8); | |
this.speed = Math.random(); | |
} | |
update() { | |
} | |
draw() { | |
} | |
} | |
function bootstrap() { | |
cv = document.getElementById('cv'); | |
cv.width = window.innerWidth; | |
cv.height = window.innerWidth; | |
let i; | |
for(i = 0; i < 10; i++) { | |
let p = new Particle(); | |
} | |
} | |
function draw() { | |
requestAnimationFrame(draw); | |
loop(); | |
} | |
function loop() { | |
} | |
bootstrap(); | |
draw(); |
This file contains hidden or 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
html, body { | |
height: 100%; | |
} | |
body { | |
background-color: #000; | |
margin: 0; | |
color: #FFF; | |
font-family: helvetica, arial, sans-serif; | |
font-weight: 700; | |
} | |
#cv { | |
display: block; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment