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
asdfkjalksfjlaksdfjlsadfkhjasdlasdlfjadsf |
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
/* | |
Objects Demo | |
Adapted from Josi's Animation Practice | |
https://sites.google.com/a/lwhs.org/computational-design-fall-16/p5-animation-practice/josi-s-p5-animation-practice | |
*/ | |
//initially, green light is on | |
var redlight = 160; |
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 button; | |
var gameState = "start"; | |
var numMarshmallows = 0; | |
var gameText = ""; | |
function setup() { | |
createCanvas(400, 300); | |
button = createButton("Yes"); | |
button.position(width/2-25, height + 50); |
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
/* Timer example using setInterval */ | |
var light_state = 0; | |
function setup() { | |
createCanvas(600, 600); | |
noStroke(); | |
//change stoplight state every 1.5 seconds | |
setInterval(change_state, 1500); |
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
/* Timer example using millis() */ | |
var timer; | |
var light_state = 0; | |
function setup() { | |
createCanvas(600, 600); | |
timer = millis(); | |
noStroke(); | |
} |
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
/* Demo: movement with a mathematical function in P5 */ | |
var x = 0; | |
function setup() { | |
createCanvas(600, 600); | |
} | |
function draw() { | |
background(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
function getParameterDefinitions() { | |
return [{ name: 'color', type: 'color', initial: '#FFB431', caption: 'Color?' }]; | |
} | |
function main(params) { | |
var box = cube(); | |
box = box.setColor(hexToRGB(params.color)); | |
return box; | |
} |
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
// title : OpenJSCAD Example | |
// author : Natalie Freed | |
function getParameterDefinitions() { | |
var parameters = [{ name: 'numCurves', type: 'int', initial: 2, caption: "num curves:" }]; | |
parameters = parameters.concat(makeSliders(1)); | |
return parameters; | |
} | |
function main(params) { |
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
// title : OpenJSCAD Bezier, 2D/3D Export Example | |
// author : Natalie Freed | |
// sources : 2D/3D export technique from Lamp Shade Example | |
function getParameterDefinitions() { | |
return [{ name: 'height', type: 'float', initial: 6, caption: "height:" }, | |
{ | |
name: 'type', | |
type: 'choice', | |
values: ["2D", "3D"], |
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
// title : OpenJSCAD Example | |
// author : Natalie Freed | |
function getParameterDefinitions() { | |
return [{ name: 'heightOfBox1', type: 'float', initial: 6, caption: "Height of box 1:" }]; | |
} | |
function main(params) { | |
var box1 = cube({size: [1,2,params.heightOfBox1]}); | |
var box2 = cube({size: [4,3,2]}); |