processing dr andy evans. processing mit media lab libraries for visualisation. wraps a simple...
TRANSCRIPT
![Page 1: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/1.jpg)
Processing
Dr Andy Evans
![Page 2: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/2.jpg)
Processinghttp://processing.org/MIT Media Lab
Libraries for visualisation.
Wraps a simple visualisation scripting language inside java classes.
Also javascript /Android / iPhone javascript versions.
Excellent community with a positive attitude to open sourcing good code.
![Page 3: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/3.jpg)
Processing Development Environment
Small put perfectly formed IDE.Saves as Applications, MPEG, SVG and PDFs.Bundles everything (data, libraries) into jars. Constructs executables.
![Page 4: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/4.jpg)
![Page 5: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/5.jpg)
Coding
Two important methods:
void setup(){ }
Runs once at start.
void draw(){}
Runs each frame until stopped (60 frames s-1; but can be changed).
![Page 6: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/6.jpg)
Coding
float x = 0;float y = 100;float speed = 1;
void setup() { size(200,200); // Size has to be first thing in setup}
void draw() {
background(255); // Wipe the background white
x = x + speed; // Change x location
if (x > width) { // Reset if it runs of the screen. x = 0; }
fill(0); // Paint a rectangle rect(x,y,30,10);}
![Page 7: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/7.jpg)
Objects
In the PDE you can put code in different tabs. However, you can also just put multiple classes in one tab.
Processing will wrap them all inside its own class, as ‘inner classes’.
![Page 8: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/8.jpg)
Java developmentExtend the Processing wrapper PApplet.
Add in your Processing code.
If you want it to run as an application, add:
public static void main(String args[]) {
PApplet.main(new String[] {
"--present", "MyProcessingSketch“
});
}
For multiple classes you need to get a reference to the Papplet class into your class then call, e.g.
papplet.draw();
![Page 9: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/9.jpg)
Eclipse
There is an Eclipse plugin:http://wiki.processing.org/w/Eclipse_Plug_In
However, you can write just as well without it:http://processing.org/learning/eclipse/
If you run as an applet in Eclipse and want to run as an application, go into File -> Properties and delete the Launch Configuration or use the arrow on the run button to “Run As”.
![Page 10: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/10.jpg)
Processing tips
Processing creates a project ‘sketchbook’ directory called after the main file for each project. It expects to find all data in a data directory in here. Libraries should also be in a ‘libraries’ directory, though better to just ‘Add File’ them.
Avoid variable names it might already use, like pixels, x, y, and z.http://forum.processing.org/topic/reserved-keywords-wiki-page
If you separate classes in to other files, call them, e.g. “Car” rather than “Car.java” – the latter signals that Processing should treat it as Java, and you’ll need to import the classes etc.
![Page 11: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/11.jpg)
Other Processing
Libraries for:XML / GPS interaction / Network communicationsConnections with Ruby/Python/JavascriptVideo / SoundCommunications with hardwareWebcam and motion recognition
Spinoff projects:Wiring/ Arduino – chipboards for hardware development
![Page 12: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/12.jpg)
Book
Great book on processing, but also modelling real systems more generally, is:
![Page 13: Processing Dr Andy Evans. Processing MIT Media Lab Libraries for visualisation. Wraps a simple visualisation scripting language](https://reader030.vdocuments.us/reader030/viewer/2022033102/56649e2d5503460f94b1c5a6/html5/thumbnails/13.jpg)
Visualisation inspiration
http://visual.ly/http://www.visualisingdata.com/Books:
JFreeChart developer guide.Processor books (see website)Visualisation books by Edward Tufte