Skip to content

Instantly share code, notes, and snippets.

View slambert's full-sized avatar

Steve Lambert slambert

View GitHub Profile
@slambert
slambert / red white ball switch.pde
Created September 13, 2016 21:52
conditionals, variables example September 13, 2016
// declare boolean variable
boolean switchstatus = false;
void setup(){
size(500,500);
background(0);
}
void draw(){
@slambert
slambert / constrain_vs_map.pde
Created September 20, 2016 20:52
Shows the difference between constrain and map functions in Processing
// Constrain vs map v1
// Steve Lambert 2016-09-20
// variables
int ball1fill; // ball #1 fill color
int ball2fill; // ball #2 fill color
void setup(){
size(500,300);
background(0);
@slambert
slambert / Far Out Light Show.pde
Last active July 17, 2019 15:57
use "states" to change background based on time passed
//Far out light show
//Steve Lambert September 20, 2016 v1
// July 17, 2019 v1.1
// declare int variable
int state = 0;
void setup(){
size(500,500);
background(0);
@slambert
slambert / click count sketch.pde
Last active September 20, 2016 21:56
Track amount of times mouse has clicked and change sketch. More than a switch....
// declare int variable
int clickcount = 0;
void setup(){
size(500,500);
background(0);
}
void draw(){
@slambert
slambert / For vs While Loop.pde
Created September 20, 2016 21:55
for vs while with same result
//Steve Lambert September 20, 2016
//for and while loop demo v1
void setup() {
size(500,500);
smooth();
} // end setup
void draw() {
@slambert
slambert / Robot.pde
Created September 27, 2016 20:22
My olde zoog
/* My Zoog
* Steve Lambert
* Some time in 2011
*/
void setup() {
size(480, 120);
smooth();
background(240);
// Modulo Example
// Steve Lambert March 2, 2017
// v0.2
// initializing variables
int interval; // how often changes
int xPos;
int yPos;
int circleW = 10;
@slambert
slambert / random.pde
Created September 27, 2016 21:08
Talking about how *where* you place random() changes the result
void setup(){
size(300,300);
smooth();
}
void draw(){
background(255);
@slambert
slambert / a function with a return.pde
Created September 27, 2016 21:09
We can get information out of a function too. Not sure this is the clearest example, but you can re-write it.
float double7;
void setup() {
size(512, 512);
}
void draw(){
double7 = double7er(mouseX);
println("double7: " + double7);
@slambert
slambert / intro_timer.pde
Created October 19, 2016 01:56
A timer to show people how long they have talked.
/*
A timer to show people how long they have talked.
todo:
- fix last bit of red?
*/
// Variables
int time;