A Few Notes August 30, 2017
Chapter 2 in a nutshell Saving files; Location Saved in folder with same name; reason HELP/Reference Use comments generously Println() and Error in console help with debugging Textbook website Don’t neglect Zoog. He’s your friend! //My comments. /* Here is a multi-line comment in Processing Language */ Examples: println(“hello world”); println(width);
Processing measures degrees or radians of a circle differently: 0 degrees/radians is located on the right side of the circle as expected. However, it increases in the clockwise direction rather than counterclockwise. Angles can be specified: in radians; in degrees (by converting into radians); or by special names of common angles, stored as variables.
Formula: Degree *( pi/180)
void setup() { // Called once when program starts } void draw() { // Called repeatedly while program runs
void setup() { size(200, 200); } void draw() { background(255); void draw() { // Try moving background() to setup() to see the difference. background(255); stroke(0); fill(175); rectMode(CENTER); fill(#ff0000); rect(mouseX, mouseY, 50, 50);
void mousePressed() { // Called when the mouse is pressed } void keyPressed() { // Called each time a key is pressed frameRate(fps); Sets number of frames displayed per second. i.e. the number of times draw() is called per second. Default = 60.
Use save() in your homework The save() function is placed within draw(). It generates a file based on the name you specify. Example: Save(bunnypic.jpg);