Skip to content

Instantly share code, notes, and snippets.

@peebeebee
Created April 19, 2016 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peebeebee/f03753b14d229c3c1d3ca76dad082b37 to your computer and use it in GitHub Desktop.
Save peebeebee/f03753b14d229c3c1d3ca76dad082b37 to your computer and use it in GitHub Desktop.
Canvas Experiments 006
div#frame
canvas#cv
"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();
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