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"; | |
var coRestitution = 0.018; | |
var coFriction = 0.01; | |
class Particle { | |
constructor(x, y) { | |
this.pos = createVector(x, y); | |
this.vel = createVector(random(-10, 10), random(-10, 10)); | |
this.acc = createVector(0, 0); |
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"; | |
class Boid { | |
constructor(x, y) { | |
this.pos = createVector(x, y); | |
this.vel = createVector(random(-1, 1), random(-1, 1)); | |
this.acc = createVector(); | |
this.maxSpeed = 3; // | |
this.maxSteerForce = 0.02; // |
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"; | |
var coRestitution = 0.018; | |
var coFriction = 0.01; | |
class Particle { | |
constructor(x, y) { | |
this.pos = createVector(x, y); | |
this.vel = createVector(random(-10, 10), random(-10, 10)); | |
this.acc = createVector(0, 0); |
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
const RESOLUTION = 3; | |
var amp = 50; | |
var freq = 0; | |
var dia = 5; | |
var freqAdj = 0.003; | |
function setup() { | |
createCanvas(600, 400); | |
} |
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"; | |
class Particle { | |
constructor(x, y) { | |
this.pos = createVector(x, y); | |
this.vel = createVector(0, 0); | |
this.acc = createVector(0, 0); | |
this.rad = rad; | |
this.r = random(255); | |
this.g = random(255); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>vectors-lab-acceleration-array</title> | |
<script src="libraries/p5.js" type="text/javascript"></script> | |
<script src="libraries/p5.dom.js" type="text/javascript"></script> | |
<script src="libraries/p5.sound.js" type="text/javascript"></script> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>vectors-lab-acceleration-array</title> | |
<script src="libraries/p5.js" type="text/javascript"></script> | |
<script src="libraries/p5.dom.js" type="text/javascript"></script> | |
<script src="libraries/p5.sound.js" type="text/javascript"></script> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>vectors-lab-acceleration-array</title> | |
<script src="libraries/p5.js" type="text/javascript"></script> | |
<script src="libraries/p5.dom.js" type="text/javascript"></script> | |
<script src="libraries/p5.sound.js" type="text/javascript"></script> |
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"; | |
var particles = []; | |
function setup() { | |
createCanvas(600, 600); | |
background(0); | |
for (var i = 0; i < 30; i++) { | |
particles.push(new Particle(random(width), random(height))); | |
} |
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
//Feb 20, 2017 | |
//Kathy Wang | |
//Week2 assignment-Fireworks | |
function Firework() { | |
this.firework = new Circle(random(width), height); | |
this.exploded = false; | |
this.circles = []; | |
this.move = function() { |
NewerOlder