A Quick Introduction to Processing

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

Lesson One: The Beginning
Processing the Danger Shield Everything you wanted to know about Processing but were afraid to ask By Ben Leduc-Mills.
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.
Introduction to shapes
Processing Lecture. 1 What is processing?
Emerging Platform#5: Processing 2 B. Ramamurthy 6/13/2014B. Ramamurthy, CS6511.
CSC 123 – Computational Art Introduction to Shape and composition
© Calvin College, Being abstract is something profoundly different from being vague... The purpose of abstraction is not to be vague, but to create.
Grundaufbau import processing.core.PApplet; public class Proc_Minimal extends PApplet { public void setup(){ size(1024, 768); frameRate(60.0f);
IAT 334 Lab 2 Computer Graphics: Rocket, PImage. June 4, 2010IAT 3342 Outline  Programming concepts –Programming Computer Graphics –Transformations –Methods.
Translate, Rotate, Matrix Pages Function Function Definition Calling a function Parameters Return type and return statement.
Translation and Rotation in 2D and 3D David Meredith Aalborg University.
Processing Processing is a simple programming environment that was created to make it easier to develop visually oriented applications with an emphasis.
IAT 334 Java using Processing ______________________________________________________________________________________ SCHOOL OF INTERACTIVE ARTS + TECHNOLOGY.
FUNDAMENTALS OF PROGRAMMING SM1204 Semester A 2011.
FUNDAMENTALS OF PROGRAMMING SM1204 Semester A 2011.
IAT 800 Lab 1: Loops, Animation, and Simple User Interaction.
, Fall 2006IAT 800 Lab 2: Polygons, Transformations, and Arrays.
Lecture 3 IAT 800. Sept 15, Fall 2006IAT 8002 Suggestions on learning to program  Spend a lot of time fiddling around with code –Programming is something.
PROCESSING Animation. Objectives Be able to create Processing animations Be able to create interactive Processing programs.
FUNDAMENTALS OF PROGRAMMING SM1204 SEMESTER A 2012.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
1 k Jarek Rossignac,  2008 Processing  Install Processing  Learn how to edit, run, save, export, post programs  Understand.
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.
Introduction to Processing CS 4390/5390 Fall 2014 Shirley Moore, Instructor September 3,
______________________________________________________________________________________ SCHOOL OF INTERACTIVE ARTS + TECHNOLOGY [SIAT] |
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Introduction to Processing. 2 What is processing? A simple programming environment that was created to make it easier to develop visually oriented applications.
B. RAMAMURTHY Simulating Motion and Implementing Animation.
Review Inheritance Overloading and overriding. example1.pde.
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.
Variables Art &Technology, 3rd Semester Aalborg University Programming David Meredith
Mouse Inputs in Processing. Interacting with the Mouse mouseX and mouseY: pg mouseXmouseY –The position of the mouse in the canvas pmouseX and.
Animation Pages Function Function Definition Calling a function Parameters Return type and return statement.
______________________________________________________________________________________ SCHOOL OF INTERACTIVE ARTS + TECHNOLOGY [SIAT] |
G RAPHICS & I NTERACTIVE P ROGRAMMING Lecture 2 More Programming with Processing.
FUNDAMENTALS OF PROGRAMMING SM1204 SEMESTER A 2012.
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.
Processing TYWu. Where can I download? 2.0b9 Windows 32-bit.
B. RAMAMURTHY Processing and Programming cse
Vertices, Curves, Color, Images mostly without details 02/16/2010.
IAT 265 Images in Processing PImage. Jun 27, 2014IAT 2652 Outline  Programming concepts –Classes –PImage –PFont.
What is Computing? What can be Programmed? Creative Computing Processing Downloading Processing Dropbox Primitive Shapes – point – line – triangle – quad.
Review Random numbers mouseX, mouseY setup() & draw() frameRate(), loop(), noLoop() Mouse and Keyboard interaction Arcs, curves, bézier curves, custom.
IAT 800 Lecture 8 PImage and PFont. Oct 13, Fall 2009IAT 8002 Outline  Programming concepts –PImage –PFont.
Programming in Processing Taught by Ms. Madsen Assistants: Ms. Fischer and Ms. Yen Winsor School, 2/20/08.
Variables. Something to mention… void setup(){ size(200, 200); background(255); smooth(); } void draw() { stroke(0); strokeWeight(abs(mouseX-pmouseX));
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.
Introduction to Processing David Meredith Aalborg University Art &Technology, 3rd Semester Programming.
IAT 265 PImage and PFont.
Chapter 14, Translate & Rotate
Polygons, Transformations, and Arrays
Lesson One: The Beginning Chapter 1: Pixels Learning Processing Daniel Shiffman Presentation by Donald W. Smith Graphics from
Chapter 15, Images …a few points
For Net Art Lecture 2 J Parker
Exam1 Review CSE113 B.Ramamurthy 11/29/2018 B.Ramamurthy.
Mouse Inputs in Processing
More programming with "Processing"
Chapter 15, Images …a few points
IAT 265 Lecture 2: Java Loops, Arrays Processing setup, draw, mouse Shapes Transformations, Push/Pop.
Translate, Rotate, Matrix
Exam1 Review CSE113 B.Ramamurthy 4/17/2019 B.Ramamurthy.
Processing Environment
Lets shape up! Pages:
Lets shape up! Pages:
Presentation transcript:

A Quick Introduction to Processing

Web Sites www.processing.org www.openprocessing.org

The Processing IDE

Hello, World!, V1 line(15, 25, 70, 90);

Coordinate System

Hello, World!, V1.1 size(400, 400); // 0..width-1 x 0..height-1 background(192, 64, 0); // rgb values stroke(255); // monochrome 0..255 line(150, 25, 270, 350);

Hello, mouse! void setup() { size(400, 400); stroke(255); background(192, 64, 0); }   void draw() { line(150, 25, mouseX, mouseY);

Static vs. Active Program Modes // declarations void setup() { // initial setup // size, smoothing // frame rate // etc } void draw() { // the stuff that loops //at frame rate size(X, Y); size(X, Y, JAVA2D/P2D/P3D/OPENGL); smooth(); frameRate(n); etc.

Mouse Events void mousePressed () { do something } void mouseDragged () {

Try void setup() { size(400, 400); stroke(255); background(192, 64, 0); }   void draw() { // nothing here void mousePressed(){ line(150, 25, mouseX, mouseY);

Try, V2 void setup() { size(400, 400); stroke(255); } void draw() {   void draw() { background(192, 64, 0); void mousePressed(){ line(150, 25, mouseX, mouseY);

Exercise 1 Whenever mouse is pressed and dragged, draw lines from mouse location to the four corners of the screen.

Hint void mouseDragged() { line(0, 0, mouseX, mouseY); line(width, 0, mouseX, mouseY); line(0, height, mouseX, mouseY); line(width, height, mouseX, mouseY); }

Basic shapes, strokes, color point(x, y); line(x1, y1, x2, y2); triangle(x1, y1, x2, y2, x3, y3); rect(Xtopleft, Ytopleft, W, H); quad(x1, y1, … , x4, y4); ellipse(Xcenter, Ycenter, W, H); stroke(R, G, B); noStroke(); strokeWeight(n); fill(R, G, B); noFill();

Example 1 size(200,200); rectMode(CENTER); rect(100,100,20,100); ellipse(100,70,60,60); ellipse(81,70,16,32); ellipse(119,70,16,32); line(90,150,80,160); line(110,150,120,160);

Example 2 int x, y; void setup() { size(400, 400); smooth(); x = 0; y = height/2; } void draw() { background(255); fill(255, 0, 0); stroke(255, 0, 0); ellipse(x, y, 50, 50); x++; Draw a red ball and make it move across the screen. Add to setup: frameRate(10);

Exercise 2 Extend to: Vary both x and y coordinates. Ensure the ball stays within bounds.

Arcs & Curves arc(x, y, width, height, start, stop); start, stop are angles in radians 0 is due east angles increase in clockwise direction curve(x1, y1, x2, y2, x3, y3, x4, y4); x1, y1 and x4, y4 are anchor points

More Shapes beginShape(); vertex(30, 20); vertex(85, 20); vertex(85, 75); vertex(30, 75); endShape(CLOSE); noFill(); beginShape(); curveVertex(84, 91); curveVertex(84, 91); curveVertex(68, 19); curveVertex(21, 17); curveVertex(32, 100); curveVertex(32, 100); endShape();

Images // Declaring a variable of type PImage PImage img;   void setup() { size(320,240); // Make a new instance of a PImage by loading an image file img = loadImage("mysummervacation.jpg"); } void draw() { background(0); // Draw the image to the screen at coordinate (0,0) image(img,0,0);

2-D Transformations translate(x, y) fill(0); translate(60, 80); rect(20, 20, 40, 40); fill(0); rect(20, 20, 40, 40);

push/pop Matrix void house(int x, int y) { pushMatrix(); translate(x, y); triangle(15, 0, 0, 15, 30, 15); rect(0, 15, 30, 30); rect(12, 30, 10, 15); popMatrix(); } for (int i = 10; i < 350; i = i + 50) { house(i, 20); }

Web Sites www.processing.org www.openprocessing.org www.cs.brynmawr.edu/cs110-02