Processing Lecture.3 Loop and animation lbg@dongseo.ac.kr.

Slides:



Advertisements
Similar presentations
Creative Computing. \\ aims By the end of the session you will be able to: 1.Move objects around 2.Write simple interactive programs 3.Use the mouse position.
Advertisements

Programming in Processing Taught by Ms. Madsen Assistants: Ms. Fischer and Ms. Yen Winsor School, 2/13/08.
Introduction to Programming
Game with US Beginner Tutorial. Welcome!! Who I am What is Processing? Basic Coding Input Methods Images Classes Arrays.
A Quick Introduction to Processing
Processing Lecture. 1 What is processing?
Recursion October 5, Reading Read pp in the text.
Emerging Platform#5: Processing 2 B. Ramamurthy 6/13/2014B. Ramamurthy, CS6511.
Variables Conditionals Loops The concept of Iteration Two types of loops: While For When do we use them? Iteration in the context of computer graphics.
Grundaufbau import processing.core.PApplet; public class Proc_Minimal extends PApplet { public void setup(){ size(1024, 768); frameRate(60.0f);
Translate, Rotate, Matrix Pages Function Function Definition Calling a function Parameters Return type and return statement.
What is iteration? I mean, what is iteration? Seriously, what is iteration?
FUNDAMENTALS OF PROGRAMMING SM1204 Semester A 2011.
IAT 800 Lab 1: Loops, Animation, and Simple User Interaction.
PROCESSING Animation. Objectives Be able to create Processing animations Be able to create interactive Processing programs.
Using Coordinate Geometry to Create Moving Images In unit 29 we created a simple drawing for the background of a children’s game. We are going to start.
FUNDAMENTALS OF PROGRAMMING SM1204 SEMESTER A 2012.
Classes / Objects An introduction to object-oriented programming.
Lecture 3 OpenGL.
Keyboard and Events. What about the keyboard? Keyboard inputs can be used in many ways---not just for text The boolean variable keyPressed is true if.
Processing Lecture.2 Mouse and Keyboard
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 7.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Review Loops – Condition – Index Functions – Definition – Call – Parameters – Return value.
Processing can load images, display them on the screen, and change their size, position, opacity, and tint. You can load gif, png and jpg images in processing.
B. RAMAMURTHY Simulating Motion and Implementing Animation.
Control flow for interactive applications CSE 3541 Matt Boggus.
CIS 3.5 Lecture 2.2 More programming with "Processing"
2-D Shapes, Color, and simple animation. 7 Basic Shapes Ellipse :: ellipse() Arc :: arc() Line :: line() Point :: point() Rectangle :: rect() Triangle.
Mouse Inputs in Processing. Interacting with the Mouse mouseX and mouseY: pg mouseXmouseY –The position of the mouse in the canvas pmouseX and.
Lesson Two: Everything You Need to Know
Animation Pages Function Function Definition Calling a function Parameters Return type and return statement.
Processing TYWu. Where can I download? 2.0b9 Windows 32-bit.
Often being different. Control flow By default Java (and therefore Processing) executes lines of a program one after the other –Doesn’t matter what happened.
Repetition 8/9/2009. Learning to Program -- Suggestions Spend a lot of time fiddling around with code –Programming is something you have to learn by doing.
Computer Science I Arrays. Parallel structures. Classwork/Homework: Build your own bouncing things.
Computer Science I Looping. User input. Classwork/Homework: Incorporate looping & user input into a sketch.
G RAPHICS & I NTERACTIVE P ROGRAMMING Lecture 2 More Programming with Processing.
Graphics Primitives in Processing 1/14/2010. size(x, y) ; Sets the initial size of the screen Units are in pixels –Pixel == picture element –Small dots.
B. RAMAMURTHY Processing and Programming cse
Test Review. General Info. All tests will be comprehensive. You will be tested more on your understanding of code as opposed to your ability to write.
Welcome to Processing Who does not have access to digital camera?
Processing Variables. Variables Processing gives us several variables to play with These variables are always being updated and you can assume they have.
Increase the number of lines before coming back to the origin … triangle square Draw a circle.
PROCESSING A computer screen is a grid of small light elements called pixels.
Loops. About the Midterm Exam.. Exam on March 12 Monday (tentatively) Review on March 5.
Chapter 14, Translate & Rotate
“Processing” easy coding Jens Dalsgaard Nielsen
Repetition.
20 minutes maximum exhibits
Chapter 7 Functions.
Computation as an Expressive Medium
Chapter 6 Loops (iteration).
Chapter 7 Functions.
For Net Art Lecture 2 J Parker
Exam1 Review CSE113 B.Ramamurthy 11/29/2018 B.Ramamurthy.
Chapter 10 Algorithms.
Mouse Inputs in Processing
Chapter 5, Conditionals Brief Notes
Chapter 10 Algorithms.
More programming with "Processing"
Just a question for Mac users:
Exam1 Review CSE113 B.Ramamurthy 4/17/2019 B.Ramamurthy.
Loops & Nested Loops CSE 120 Winter 2019
Chapter 10 Algorithms.
Trigonometry & Random March 2, 2010.
How About Some PI? Trigonometry Feb 18,2009.
Chapter 13, Math A few Examples.
Moving Sprites at Random
Chapter 9 Arrays.
Presentation transcript:

Processing Lecture.3 Loop and animation lbg@dongseo.ac.kr

INDEX Loop and animation Do it : Simple example Homework

Homework solution

Lecture plan What is Processing + Simple drawing Mouse + Keyboard input event Loop and animation Processing + Kinect Flash + Kinect

Loop and Animation

Loop and animation for() while() for(initialize value; condition; calculate); Ex) for(int i=0; i<5; i++) while() while(condition) Ex) while(i==10) Initialize Process Condition Quit Yes No Process Condition Quit Yes No

Loop and animation for() void setup(){ size(200, 200); background(255); } void draw(){ int endLegs = 150; int x = 50, y = 50, spacing = 30, len = 50; stroke(0); for(x = 50; x <= endLegs; x=x+spacing) { line(x,y,x,y+len);

Loop and animation while() void setup(){ size(200, 200); background(255); } void draw(){ int endLegs = 150; int x = 50, y = 50, spacing = 30, len = 50; stroke(0); while(x <= endLegs){ line(x,y,x,y+len); x=x+spacing;

Do it : Simple example

Do it: Simple example(Loop) void setup(){ size(200, 200); background(255); } void draw(){ stroke(0); for(int i = 10; i < 200; i+=10){ line(0, i, 200, i);

Do it: Simple example(Loop) void setup(){ size(200, 200); background(255); } void draw(){ stroke(0); for(int i = 200; i > 0; i-=20){ fill(i); ellipse(100, 100, i, i);

Do it: Simple example(Loop) void setup(){ size(255, 200); background(255); } void draw(){ stroke(0); int x = 0; for(int c = 255; c > 0; c-=15){ fill(c); rect(x, 0, x+15, height); x=x+15;

Do it: Simple example(Animate) Animation int x = 0; int y = 0; void setup( ){ size(100, 100); noStroke( ); } void draw( ){ background(0); rect(x, 0, 5, height); x=x+1; if(x>width) x=0; rect(0, y, width, 5); y=y+1; if(y>height) y=0;

Do it: Simple example(Animate) Animation int x = 0; int y = 0; void setup( ){ size(100, 100); noStroke( ); } void draw( ){ background(0); rect(x, y, 10, 10); x+=5; if(x>=width){ x=0; y+=5; if(y>=height){ y=0;

Homework

Homework

Q& A