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(10554)
The remains of the day by Kazuo Ishiguro(7577)
Spare by Prince Harry The Duke of Sussex(4222)
Paper Towns by Green John(4178)
The Body: A Guide for Occupants by Bill Bryson(3817)
Be in a Treehouse by Pete Nelson(3234)
Harry Potter and the Goblet Of Fire by J.K. Rowling(3079)
Goodbye Paradise(2978)
Never by Ken Follett(2910)
Into Thin Air by Jon Krakauer(2712)
The Remains of the Day by Kazuo Ishiguro(2627)
The Genius of Japanese Carpentry by Azby Brown(2616)
The Cellar by Natasha Preston(2605)
Drawing Shortcuts: Developing Quick Drawing Skills Using Today's Technology by Leggitt Jim(2537)
120 Days of Sodom by Marquis de Sade(2446)
Architecture 101 by Nicole Bridge(2356)
Machine Learning at Scale with H2O by Gregory Keys | David Whiting(2319)
The Man Who Died Twice by Richard Osman(2310)
Industrial Automation from Scratch: A hands-on guide to using sensors, actuators, PLCs, HMIs, and SCADA to automate industrial processes by Olushola Akande(2130)