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 c; | |
| function setup() { | |
| c = createCanvas(800, 600); | |
| console.log(width, height); | |
| } | |
| function draw() { | |
| background(95, 65, 26); | |
| }; |
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 c; | |
| var t; | |
| var i; | |
| var DOMMaker = new p5DOM(this); | |
| function setup() { | |
| c = createCanvas(800, 600); | |
| c.parent('test'); | |
| i = DOMMaker.createImg("https://avatars1.githubusercontent.com/u/191056?s=460", "alt_text"); | |
| i.position(0, 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
| var c; | |
| var t; | |
| var i; | |
| function setup() { | |
| c = createCanvas(800, 600); | |
| var n = document.getElementById('test'); | |
| c.parent(n); | |
| c.position(100, 100); | |
| c.id('myc'); |
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 s0 = function( sketch ) { | |
| var gray = 0; | |
| var h = 10; | |
| sketch.setup = function() { | |
| var cnv = sketch.createCanvas(400, 400); | |
| cnv.mousePressed(increaseH); | |
| sketch.rectMode(sketch.CENTER); | |
| sketch.print("both gray values should change, rect in sketch0 should change only when clicking on canvas0"); |
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
| function setup() { | |
| // var v0 = createVector(1, 2, 3); | |
| // var v2 = new PVector(1, 2, 3); | |
| // console.log(v0.heading()); | |
| // console.log(v2.heading()); | |
| // angleMode(DEGREES); | |
| // console.log(v0.heading()); | |
| // console.log(v2.heading()); | |
| createCanvas(500, 500); | |
| background(250, 100, 20); |
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
| import processing.video.*; | |
| import java.io.FilenameFilter; | |
| // assets | |
| Movie clip; | |
| Table data; // pos-f, eng-f, neg-f, pos-m, eng-m, neg-m | |
| PShape menSVG, womenSVG, cannesSVG, eyesSVG; | |
| PFont ralewayF, titilliumF; | |
| // styling |
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 c = document.getElementById('test'); | |
| var runnable = c.innerText; | |
| for (var a in p5.prototype) { | |
| runnable = runnable.replace(new RegExp(a, 'g'), 'p.'+a); | |
| } | |
| var s = function( p ) { |
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
| <div class="example"> | |
| <pre> | |
| <code class="language-javascript"> | |
| var dim; | |
| function setup() { | |
| createCanvas(600, 400); | |
| dim = width/2; | |
| background(0); | |
| colorMode(HSB, 360, 100, 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
| function renderCode(sel) { | |
| var k = p5; | |
| var instances = []; | |
| var selector = sel || 'example'; | |
| var examples = document.getElementsByClassName(selector); | |
| if (examples.length > 0) { | |
| var sketches = examples[0].getElementsByTagName('code'); | |
| var sketches_array = Array.prototype.slice.call(sketches); | |
| var i = 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
| <script type="text/javascript" src="http://lauren-mccarthy.com/test/p5.js/p5.min.js"></script> | |
| <!-- optional addons --> | |
| <script type="text/javascript" src="http://lauren-mccarthy.com/test/p5.js/p5.sound.js"></script> | |
| <script type="text/javascript" src="http://lauren-mccarthy.com/test/p5.js/p5.dom.js"></script> | |
| <script type="text/javascript" src="http://lauren-mccarthy.com/test/p5.js/jquery-1.9.1.min.js"></script> | |
| <script type="text/javascript" src="http://lauren-mccarthy.com/test/p5.js/render.js"></script> | |
| <!-- code highlighting --> |