Skip to content

Instantly share code, notes, and snippets.

View claytical's full-sized avatar

Clay Ewing claytical

View GitHub Profile
@claytical
claytical / sketch.js
Created September 15, 2015 01:45
Zeno's Paradox
var x;
var y;
var easing;
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
easing = .025;
x = width/2;
y = height/2;
@claytical
claytical / sketch.js
Created September 22, 2015 02:21
Simple Array Example
var selectedBall;
var ballSizes;
function setup() {
createCanvas(windowWidth, windowHeight);
selectedBall = 0;
ballSizes = [40,50,30,20];
}
function draw() {
@claytical
claytical / sketch.js
Created September 22, 2015 02:27
Simple Array with Text
var selectedBall;
var ballSizes;
function setup() {
createCanvas(windowWidth, windowHeight);
selectedBall = 0;
ballSizes = [40,50,30,20];
}
function draw() {
@claytical
claytical / sketch.js
Created September 22, 2015 02:36
Adding to an Arrya and Displaying Coordinates
var selectedBall;
var xCoordinates;
var yCoordinates;
function setup() {
createCanvas(windowWidth, windowHeight);
selectedBall = 0;
xCoordinates = [];
yCoordinates = [];
}
@claytical
claytical / sketch.js
Created September 28, 2015 21:59
While Example
var dots = [];
function setup() {
createCanvas(windowWidth, windowHeight);
while(dots.length < 10) {
dots.push(random(10,50));
}
}
@claytical
claytical / sketch.js
Created September 28, 2015 22:01
For Example
var dots = [];
function setup() {
createCanvas(windowWidth, windowHeight);
for (var i = 0; i < 10; i++) {
dots.push(random(10,50));
}
}
@claytical
claytical / sketch.js
Created September 28, 2015 22:14
Nested For Loop Example
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(0);
noFill();
stroke(255);
@claytical
claytical / sketch.js
Created September 28, 2015 22:21
Saving Points Example
var xPoints = [];
var yPoints = []
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(0);
@claytical
claytical / sketch.js
Created October 3, 2015 16:44
Simple Ball Object Example
var ball = { x: 50,
y: 50,
diameter: 50
};
function setup() {
createCanvas(windowWidth, windowHeight);
}
@claytical
claytical / sketch.js
Created October 3, 2015 16:50
Simple Object with Array Example
var Ball = function() {
this.x = mouseX;
this.y = mouseY;
this.diameter = 10;
}
var balls = [];