Coding Art by Mathias Funk & Yu Zhang
Author:Mathias Funk & Yu Zhang
Language: eng
Format: epub
ISBN: 9781484297803
Publisher: Apress
In this example (Figure 5-1), we use the keyboard to switch between shapes and colors. This is only a simple example. You can use the keyboard to switch between different functions controlling many things or create a switchable demo of all examples in this book. As a final example for âbackstaging,â letâs make a sketch that uses the keyboard to reset.
Figure 5-1 Example of how we can reset the canvas after drawing frame over frame
USE THE KEYBOARD TO RESET THE VISUAL OUTPUT
void setup() {
size(400, 400);
background(0); noStroke(); rectMode(CENTER);
}
void draw() {
fill(40 + 20 * noise(0.8 - frameCount/2000.), 155, noise(frameCount/100.) * 255, random(10, 200));
rect(width * noise(0.2 + frameCount/100.), height * noise(0.3 + frameCount/200.), 100, 100);
}
void keyPressed(){
background(0);
}
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Kathy Andrews Collection by Kathy Andrews(11268)
The remains of the day by Kazuo Ishiguro(8332)
Paper Towns by Green John(4747)
Spare by Prince Harry The Duke of Sussex(4744)
The Body: A Guide for Occupants by Bill Bryson(4531)
Industrial Automation from Scratch: A hands-on guide to using sensors, actuators, PLCs, HMIs, and SCADA to automate industrial processes by Olushola Akande(4387)
Be in a Treehouse by Pete Nelson(3620)
Harry Potter and the Goblet Of Fire by J.K. Rowling(3574)
Never by Ken Follett(3477)
Goodbye Paradise(3410)
Machine Learning at Scale with H2O by Gregory Keys | David Whiting(3398)
The Remains of the Day by Kazuo Ishiguro(3097)
Into Thin Air by Jon Krakauer(3093)
The Cellar by Natasha Preston(3058)
The Genius of Japanese Carpentry by Azby Brown(3009)
Drawing Shortcuts: Developing Quick Drawing Skills Using Today's Technology by Leggitt Jim(2909)
120 Days of Sodom by Marquis de Sade(2903)
Fairy Tale by Stephen King(2832)
The Man Who Died Twice by Richard Osman(2771)
