1 / 23

Introduction to Processing

Computer Science. Dominique Thiebaut. Introduction to Processing. Dominique Thiebaut Dept. Computer Science. Thiebaut -- Computer Science. Computer Science. Dominique Thiebaut. Who? Where? Why?. Ben Fry & Casey Reas MIT Media Labs.

Download Presentation

Introduction to Processing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Science Dominique Thiebaut Introduction to Processing • Dominique Thiebaut • Dept. Computer Science Thiebaut -- Computer Science

  2. Computer Science Dominique Thiebaut Who? Where? Why? • Ben Fry & Casey Reas • MIT Media Labs 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. Computer Science Dominique Thiebaut Ben Fry on Processing... http://www.youtube.com/watch?&v=z-g-cWDnUdU

  4. Computer Science Dominique Thiebaut An Example An Example • http://processing.org = GREAT RESOURCE! • Mouse 2D Examplehttp://processing.org/examples/mouse2d.html

  5. Computer Science Dominique Thiebaut How does it Work?

  6. Computer Science Dominique Thiebaut How does it Work? • Java • Java independent of operating system • Processing works on Windows, Mac, Linux

  7. Computer Science Dominique Thiebaut Writing a Sketch

  8. Computer Science Dominique Thiebaut Writing a Sketch • Functions • User functions • Library functions • Predefined: • setup() • draw() • mouseX • mouseY

  9. Computer Science Dominique Thiebaut Run/Stop

  10. Computer Science Dominique Thiebaut Learning Processing(Learning Java Syntax)

  11. Computer Science Dominique Thiebaut Some Examples • Assembly language programs • Graphics/Interactive programs

  12. Computer Science Dominique Thiebaut Assembly LanguageExample 1 • void setup() { • int a = 10; • int b = 20; • int c = 0; • c = a+b; • println(“c= “ + c); • } Add two variables and store their sum into a third variable

  13. Computer Science Dominique Thiebaut Example 2 • void setup() { • int count = 1; • while (true) { • println(count); • count = count+1; • } • } Write an infinite loop that prints all the positive integers.

  14. Computer Science Dominique Thiebaut Example 2 • void setup() { • int count = 1; • while (true) { • println(count); • count = count+1; • } • } Write an infinite loop that prints all the positive integers.

  15. Computer Science Dominique Thiebaut Example 2 • void setup() { • int count = 1; • while (true) { • println(count); • count = count+1; • } • } Write an infinite loop that prints all the positive integers.

  16. Computer Science Dominique Thiebaut Example 3 • void setup() { • int count = 1; • while ( ) { • println(count); • count = count+1; • } • } Write an loop that prints all the integers from 1 to 10.

  17. Computer Science Dominique Thiebaut Example 3 • void setup() { • int count = 1; • while (count<=10) { • println(count); • count = count+1; • } • } Write an loop that prints all the integers from 1 to 10.

  18. Computer Science Dominique Thiebaut Example 4 • void setup() { • int count = 1; • int sum = 0; • while ( ) { • } • } Write an loop that computes the sum of all the integers from 1 to 10 and prints the result.

  19. Computer Science Dominique Thiebaut Example 4 • void setup() { • int count = 1; • int sum = 0; • while (count<=10) { • sum = sum+count; • count = count+1; • } • println(“sum=”+sum); • } Write an loop that computes the sum of all the integers from 1 to 10 and prints the result.

  20. Computer Science Dominique Thiebaut Some Examples • Assembly language programs • Graphics/Interactive programs

  21. Computer Science Dominique Thiebaut First Graphics Program • void setup() { • size(480, 480); • smooth(); • } • void draw() { • ellipse(mouseX, mouseY, 80, 80); • }

  22. Computer Science Dominique Thiebaut 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

  23. Computer Science Dominique Thiebaut

More Related