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
| float x = 512; | |
| float x1 = 10; | |
| float y = 288; | |
| float y1 = 5; | |
| void setup() { | |
| size(1024, 576); // 16:9 | |
| frameRate(60); | |
| background(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
| 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(); |
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
| 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)); |
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 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() { |
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
| 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 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
| var cir = []; | |
| function setup() { | |
| createCanvas(1152, 648); | |
| for(var i = 0; i < 1000; i++) { | |
| cir[i] = new Cir(); | |
| } | |
| } | |
| function draw() { |
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
| // based on Shiffman's original version | |
| var bl = []; | |
| function setup(){ | |
| createCanvas(1152, 648); | |
| } | |
| function mouseDragged(){ | |
| bl.push(new Ball(mouseX, mouseY)); | |
| } |
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
| 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(); |
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
| // 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)); |
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
| // 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); |