1 / 7

Simulating Motion and Implementing Animation

Simulating Motion and Implementing Animation. B. Ramamurthy. Processing Features for Motion/animation. f ill(), nofill () in color commands l oop(), noloop () : this is for controlling draw() function frameRate () h eight, width Displaying text on the screen t ranslate () r otate().

olympe
Download Presentation

Simulating Motion and Implementing Animation

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. Simulating Motion and Implementing Animation B. Ramamurthy

  2. Processing Features for Motion/animation fill(), nofill() in color commands loop(), noloop() : this is for controlling draw() function frameRate() height, width Displaying text on the screen translate () rotate()

  3. Display Text on Screen PFont f; // STEP 1 Declare PFont variable void setup() { size(200,200); f = createFont("Arial",16,true); // STEP 2 Create Font } int x= 10; int y = 100; void draw() { background(255); textFont(f,16); // STEP 3 Specify font fill(0); // STEP 4 Specify font color text("Hello Strings!",x, y); // STEP 5 Display Text }

  4. Print text on the terminal window These are useful for debugging print( string); println(string) Example: println (“Position of the animal is” + x, “ “ + y);

  5. frameRate() Observe naming convention “frame” “Rate” Specifies the number of frames to be displayed every second: default is 60 sec void setup() { frameRate(4); } intpos = 0; void draw() { background(204); pos++; line(pos, 20, pos, 80); if (pos > width) { pos = 0; } }

  6. loop() and noloop() And redraw() draw() function by default keeps looping without any control . You make control it using loop() and noloop() function calls You can also call draw to execute only once by calling redraw() function

  7. translate and rotate Last class we looked at translating (moving x and y) by moving the object. You can also simulate this by moving the grid, that’s what translate(x,y) function does. You can also rotate the object by rotating the grid. It takes the parameters in radians. We think is degrees. We have a function radians() to convert degrees to radians. Lets look at some examples.

More Related