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 / ellipse.js
Created April 19, 2016 15:33
Ellipse. Using processing.js library.
float x = 512;
float x1 = 10;
float y = 288;
float y1 = 5;
void setup() {
size(1024, 576); // 16:9
frameRate(60);
background(0);
}
@nick3499
nick3499 / hour-minute-second.js
Created April 19, 2016 15:34
Hour Minute Second. Using processing.js library.
void setup() {
size(480, 270);
textSize(40);
}
void draw() {
background(0);
String tm = "TIME: " + hour() + ":" + nf(minute(),2) + ":" + nf(second(),2);
String dy = "DAY: " + day();
String mn = "MONTH: " + month();
@nick3499
nick3499 / load-pixels.js
Created April 19, 2016 15:35
Load Pixels. Using processing.js library.
void setup () {
size (1024, 576); <!-- 16:9 284.625 -->
colorMode(HSB, 360, 100, 100);
frameRate(5);
}
void draw () {
loadPixels();
for (int i=0; i<pixels.length; i++) {
pixels[i] = color(random(360),random(100),random(100));
@nick3499
nick3499 / p5-html.html
Created April 19, 2016 15:37
P5 HTML. Using p5.js library.
<!doctype html public "graphics">
<head>
<meta charset=utf-8>
<title>HTML File Example</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.23/p5.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.23/addons/p5.dom.min.js"></script>
<!-- included DOM addon library for adding various html elements -->
<!-- paste all of this code into a text editor and saveas .html file. you're done! -->
<script>
function setup() {
@nick3499
nick3499 / numbers-array.js
Created April 19, 2016 15:46
Numbers Array. Using p5.js library.
var nums = [600, 500, 400, 300, 200, 100];
function setup() {
createCanvas(648, 648);
}
function draw() {
background(random(85, 170), random(85, 170), random(85, 170));
stroke(random(85, 170), random(85, 170), random(85, 170), 100);
strokeWeight(60);
@nick3499
nick3499 / blue-ellipse-array.js
Created April 19, 2016 15:48
Blue Ellipse Array. Using p5.js library.
var cir = [];
function setup() {
createCanvas(1152, 648);
for(var i = 0; i < 1000; i++) {
cir[i] = new Cir();
}
}
function draw() {
@nick3499
nick3499 / blue-bubble-click-drag.js
Created April 19, 2016 15:50
Blue Bubble Click Drag. Using p5.js library.
// based on Shiffman's original version
var bl = [];
function setup(){
createCanvas(1152, 648);
}
function mouseDragged(){
bl.push(new Ball(mouseX, mouseY));
}
@nick3499
nick3499 / color-ellipse-array.js
Created April 19, 2016 15:52
Color Ellipse Array. Using p5.js library.
var cir = [];
function setup() {
createCanvas(1152, 648);
for (var i = 0; i < 400; i++)
cir[i] = {
x: random(0, width),
y: random(0, height),
display: function() {
noStroke();
@nick3499
nick3499 / ellipse-array-click-drag-push-splice.js
Created April 19, 2016 15:54
Ellipse Array Click Drag Push Splice. Using p5.js library.
// based on orig. version featured in one of Shiffman's video tutorials
// push append
var bubbles = [];
function setup() {
createCanvas(1152, 648);
}
function mouseDragged() {
bubbles.push(new Bubble(mouseX, mouseY));
@nick3499
nick3499 / ellipse-number-array.js
Created April 19, 2016 15:57
Ellipse Number Array. Using p5.js library.
// featured in one of Shiffman's video tutorials
var nums = [100, 25, 46, 72];
function setup() {
createCanvas(500, 400);
}
function draw() {
background(0);
stroke(255);