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 data; | |
var setup = function() { | |
createGraphics(600, 400); | |
loadJSON("sample.js", function(resp) { | |
data = resp; | |
console.log(data) | |
}); | |
}; |
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
// mouse events - mousePressed(), mouseReleased(), mouseMoved(), mouseDragged() | |
// runs once each time unlike mousepressed | |
var gray = 0; | |
function setup() { | |
createGraphics(600, 400); | |
} |
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
// Note: all of these are demonstrating the implicit version where | |
// no canvas or div is specified, and one is automatically generated. | |
// With all of these it would be possible to also pass in a node. | |
// Option 1: sketch is obj created and run by p5 | |
var sketch = new P5.createSketch(); | |
sketch.gray = 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(600, 400); | |
background(255, 0, 0); | |
} | |
function draw() { | |
} |
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 angle = 0; | |
var img; | |
function setup() { | |
cnv = createCanvas(600, 400); | |
//noLoop(); | |
noStroke(); | |
console.log(img); | |
img = createHTMLImage("https://pbs.twimg.com/media/BkLMTz9IIAAKobt.jpg"); |
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 div; | |
var cnv; | |
var x = 0; | |
function setup() { | |
cnv = createCanvas(600, 400); | |
div = createHTML("HERE IS TEXT"); | |
} |
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 element; | |
function setup() { | |
element = createHTML("You chose the color ______"); | |
element.style("color:blue"); | |
} | |
function draw() { |
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
// https://github.com/auduno/headtrackr | |
// http://auduno.github.io/headtrackr/documentation/reference.html | |
var mySketch = function(sketch) { | |
var pop; | |
var radius = 10; | |
var y = 270; | |
sketch.setup = function() { |
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 values = { | |
radius: 40, | |
opacity: 1, | |
color: 'red', | |
animate: false | |
}; | |
var components = { | |
radius: { | |
type: 'slider', label: 'Radius', |
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
//// TOUCHX/Y | |
// touch events are very similar to mouse events | |
var red = 0; | |
function setup() { | |
createCanvas(windowWidth, windowHeight); | |
noStroke(); | |
fill(255, 255, 255); |