Skip to content

Instantly share code, notes, and snippets.

View nick3499's full-sized avatar
🏠
Working from home

nick3499 nick3499

🏠
Working from home
  • USA
View GitHub Profile
@nick3499
nick3499 / lerp-color-4.js
Created April 19, 2016 15:11
Lerp Color 4. Using p5.js library.
function setup() {
createCanvas(720, 400);
}
function draw() {
background(0);
noStroke (0);
from = color (255, 0, 0, 0.1 * 255);
to = color (255, 255, 0, 1.0 * 255);
lerp1 = lerpColor(from, to, 0.33);
@nick3499
nick3499 / load-pixels.js
Created April 19, 2016 15:12
Load Pixels. Using p5.js library.
function setup () {
createCanvas(1152, 648);
background(0);
}
function draw () {
loadPixels();
var d = pixelDensity();
var t = 4 * (width * d) * (height * d);
for (var i = 0; i < t; i += 4) {
@nick3499
nick3499 / quad.js
Created April 19, 2016 15:13
Quad. Using p5.js library.
function setup() {
createCanvas(720, 400);
}
function draw() {
background(0, random(170, 255), random(170, 255));
noStroke(0);
for (var i = 0; i < 20; i++) {
// quad a
var x1 = random(0, 360);
@nick3499
nick3499 / triangle.js
Created April 19, 2016 15:14
Triangle.Using p5.js library.
function setup() {
createCanvas(720, 400);
}
function draw() {
background(0, random(128, 255), random(128, 255));
noStroke(0);
for (var i = 0; i < 20; i++) {
// triangle a
var x1 = random(0, 360);
@nick3499
nick3499 / vector.js
Created April 19, 2016 15:15
Vector. Using p5.js library.
var l = new p5.Vector(576, 324);
var v = new p5.Vector(16, 9);
function setup() {
createCanvas(1152, 648);
}
function draw() {
background(255);
l.add(v);
@nick3499
nick3499 / array.js
Created April 19, 2016 15:25
Array. Using processing.js library.
float [] x;
float [] y;
float [] xv;
float [] yv;
int population = 100;
void setup() {
size(1024, 576);
frameRate(60);
x = new float[population];
@nick3499
nick3499 / array-list.js
Created April 19, 2016 15:27
Array List. Using processing.js library.
ArrayList population;
void setup() {
size(1024, 576);
smooth();
frameRate(30);
population = new ArrayList();
for(int i=0; i<200; i++) {
Ball myBall = new Ball(random(0,width),random(0,200));
population.add(myBall);
@nick3499
nick3499 / array-list-2.js
Created April 19, 2016 15:29
Array List 2. Using processing.js library.
ArrayList population;
void setup() {
size(1024, 576);
smooth();
frameRate(30);
population = new ArrayList();
}
void draw() {
@nick3499
nick3499 / bezier.js
Created April 19, 2016 15:30
Bezier. Using processing.js library.
void setup () {
size(1024, 576);
noFill();
smooth();
colorMode(HSB, 270, 100, 100);
frameRate(10);
}
void draw () {
background(0);
@nick3499
nick3499 / ball-class.js
Created April 19, 2016 15:32
Ball Class. Using processing.js library.
Ball[] population = new Ball[400];
void setup() {
size(1024, 576);
smooth();
frameRate(30);
for(int i=0; i<400; i++) {
population[i] = new Ball(random(0, width), random(0, 100));
}
}