This file contains 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 lang="en"> | |
<head> | |
<meta charset=utf-8> | |
<title> | |
Gravitational Force | |
</title> | |
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> | |
</head> | |
<body> |
This file contains 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
function setup() { | |
createCanvas(720, 400); | |
} | |
function draw() { | |
background(random(128, 255), random(128, 255), random(128, 255)); | |
noStroke(0); | |
for (var i = 0; i < 100; i++) { | |
var x1 = random(0, width); | |
var y1 = random(0, height); |
This file contains 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
function setup() { | |
createCanvas(720, 400); | |
} | |
function draw() { | |
background(random(0, 255), random(0, 255), random(0, 255)); | |
noStroke(0); | |
for (var i = 0; i < 50; i++) { | |
var x1 = random(0, width); | |
var y1 = random(0, height); |
This file contains 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
function setup () { | |
createCanvas(896, 504); | |
} | |
function draw () { | |
background('#ed225d'); | |
noStroke(); | |
for (i = 0; i < 6000; i++) { | |
fill(random(255), random(0, 170), random(255), 150); | |
// negative x-axis values help arc chords fill entire canvas |
This file contains 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
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); |
This file contains 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
var x = 100; | |
var y = 50; | |
function setup() { | |
// decreased resolution = increased performance | |
createCanvas(896, 504); | |
} | |
function draw() { | |
background(0); |
This file contains 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
function setup() { | |
createCanvas(720, 400); | |
background(255); | |
noStroke(); | |
} | |
function draw() { | |
background(255); | |
from = color(255, 0, 0, 0.2 * 255); | |
to = color(0, 0, 255, 0.2 * 255); |
This file contains 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
var e = { x: 0, y: 360, d: 100 }; | |
var c1 = { r: 0, g: 255, b: 255 }; | |
var c2 = { r: 255, g: 255, b: 0 }; | |
function setup() { | |
createCanvas( 1280, 720 ); | |
} | |
function draw() { | |
// dot syntax |
This file contains 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
function setup() { | |
createCanvas(720, 400); | |
background(255); | |
stroke(255); | |
strokeWeight(2); | |
} | |
function draw() { | |
background(255); | |
from = color(255, 255, 0, 0.2 * 255); |
This file contains 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
var b1, b2; | |
function setup() { | |
createCanvas(1024, 576); | |
} | |
function draw() { | |
background(255); | |
from = color('rgba(255,0,0,0.3)'); | |
to = color('rgba(0,0,255,0.3)'); | |
c1 = lerpColor(from, to, 0.20); |
OlderNewer