Download presentation
Presentation is loading. Please wait.
Published bySilvester Houston Modified over 8 years ago
1
Introduction to Processing Dominique Thiebaut Dept. Computer Science Computer Science Dominique Thiebaut Thiebaut -- Computer Science
2
Who? Where? Why? Ben Fry & Casey Reas MIT Media Labs Computer Science Dominique Thiebaut Processing is a programming language and environment built for the media arts communities. It is created to teach fundamentals of computer programming within the media arts context and to serve as a software sketchbook. It is used by students, artists, designers, architects, and researchers for learning, prototyping, and production.
3
Ben Fry on Processing... Computer Science Dominique Thiebaut http://www.youtube.com/watch?&v=z-g-cWDnUdU
4
http://processing.org = GREAT RESOURCE! http://processing.org Mouse 2D Example http://processing.org/examples/mouse2d. html http://processing.org/examples/mouse2d. html Computer Science Dominique Thiebaut An Example
5
How does it Work? Computer Science Dominique Thiebaut
6
How does it Work? Java Java independen t of operating system Processing works on Windows, Mac, Linux Computer Science Dominique Thiebaut
7
Writing a Sketch Computer Science Dominique Thiebaut
8
Writing a Sketch Computer Science Dominique Thiebaut Functions User functions Library functions Predefined: setup() draw() mouseX mouseY
9
Run/Stop Computer Science Dominique Thiebaut
10
Learning Processing (Learning Java Syntax) Computer Science Dominique Thiebaut
11
Some Examples Assembly language programs Graphics/Interactive programs Computer Science Dominique Thiebaut
12
Assembly Language Example 1 Computer Science Dominique Thiebaut Add two variables and store their sum into a third variable void setup() { int a = 10; int b = 20; int c = 0; c = a+b; println(“c= “ + c); }
13
Example 2 Computer Science Dominique Thiebaut Write an infinite loop that prints all the positive integers. void setup() { int count = 1; while (true) { println(count); count = count+1; }
14
void setup() { int count = 1; while (true) { println(count); count = count+1; } Example 2 Computer Science Dominique Thiebaut Write an infinite loop that prints all the positive integers.
15
void setup() { int count = 1; while (true) { println(count); count = count+1; } Example 2 Computer Science Dominique Thiebaut Write an infinite loop that prints all the positive integers.
16
Example 3 Computer Science Dominique Thiebaut Write an loop that prints all the integers from 1 to 10. void setup() { int count = 1; while ( ) { println(count); count = count+1; }
17
void setup() { int count = 1; while (count<=10) { println(count); count = count+1; } Example 3 Computer Science Dominique Thiebaut Write an loop that prints all the integers from 1 to 10.
18
void setup() { int count = 1; int sum = 0; while ( ) { } Example 4 Computer Science Dominique Thiebaut Write an loop that computes the sum of all the integers from 1 to 10 and prints the result.
19
void setup() { int count = 1; int sum = 0; while (count<=10) { sum = sum+count; count = count+1; } println(“sum=”+sum); } Example 4 Computer Science Dominique Thiebaut Write an loop that computes the sum of all the integers from 1 to 10 and prints the result.
20
Some Examples Assembly language programs Graphics/Interactive programs Computer Science Dominique Thiebaut
21
First Graphics Program void setup() { size(480, 480); smooth(); } void draw() { ellipse(mouseX, mouseY, 80, 80); } Computer Science Dominique Thiebaut
22
Some Variations to Try Lookup the rect() function in the Processing.org reference section. Replace the ellipse by a rectangle Lookup the background() function and place it in draw() Fill the ellipse or rectangle with a color using the fill() function Computer Science Dominique Thiebaut
23
Computer Science Dominique Thiebaut
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.