Www.processing.org. Grundaufbau import processing.core.PApplet; public class Proc_Minimal extends PApplet { public void setup(){ size(1024, 768); frameRate(60.0f);

Slides:



Advertisements
Similar presentations
Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Advertisements

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.
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?
Variables and Operators
Recursion October 5, Reading Read pp in the text.
Emerging Platform#5: Processing 2 B. Ramamurthy 6/13/2014B. Ramamurthy, CS6511.
© Calvin College, Being abstract is something profoundly different from being vague... The purpose of abstraction is not to be vague, but to create.
Color by Numbers Pages Syntax Introduced color color() colorMode()
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.
Color by Numbers Pages (Skipped Curves 79-84)
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.
FUNDAMENTALS OF PROGRAMMING SM1204 Semester A 2010/2011.
, 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.
Review Blocks of code {.. A bunch of ‘statements’; } Structured programming Learning Processing: Slides by Don Smith 1.
FUNDAMENTALS OF PROGRAMMING SM1204 SEMESTER A 2012.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Week 2 Book Chapter 1 RGB Color codes. 2 2.Additive Color Mixing RGB The mixing of “ light ” Primary: Red, Green, Blue The complementary color “ White.
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.
Processing Lecture.2 Mouse and Keyboard
Review of ArT3 Programming Course David Meredith Aalborg University
Transforming Geometry Groundhog Day. Drawing Quads In a 300 by 200 window, draw two quads of different colors. Don’t show the grey grid.
______________________________________________________________________________________ SCHOOL OF INTERACTIVE ARTS + TECHNOLOGY [SIAT] |
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 02b: Tutorial for Programming in Processing Jarek Rossignac.
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.
Processing TYWu. Where can I download? 2.0b9 Windows 32-bit.
FUNDAMENTALS OF PROGRAMMING SM1204 SEMESTER A 2012.
B. RAMAMURTHY Processing and Programming cse
Welcome to Processing Who does not have access to digital camera?
Computation as an Expressive Medium Lab 2: Polygons, Transformations, and Arrays (Oh My) Micah.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Processing  Install Processing  Learn how to edit, run, save, export,
IAT 265 Images in Processing PImage. Jun 27, 2014IAT 2652 Outline  Programming concepts –Classes –PImage –PFont.
Processing Variables. Variables Processing gives us several variables to play with These variables are always being updated and you can assume they have.
Review Random numbers mouseX, mouseY setup() & draw() frameRate(), loop(), noLoop() Mouse and Keyboard interaction Arcs, curves, bézier curves, custom.
Computer Science I Text input. Transformations. Yet another jigsaw. Classwork/Homework: Create new application making use of transformations.
IAT 800 Lecture 8 PImage and PFont. Oct 13, Fall 2009IAT 8002 Outline  Programming concepts –PImage –PFont.
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.
Some of Chap 17.
IAT 265 PImage and PFont.
Chapter 14, Translate & Rotate
For Net Art Lecture 2 J Parker
Exam1 Review CSE113 B.Ramamurthy 11/29/2018 B.Ramamurthy.
Mouse Inputs in Processing
Chapter 5, Conditionals Brief Notes
IAT 265 Lecture 2: Java Loops, Arrays Processing setup, draw, mouse Shapes Transformations, Push/Pop.
Translate, Rotate, Matrix
Animation Pages
Exam1 Review CSE113 B.Ramamurthy 4/17/2019 B.Ramamurthy.
Computation as an Expressive Medium
Trigonometry & Random March 2, 2010.
How About Some PI? Trigonometry Feb 18,2009.
Chapter 13, Math A few Examples.
Presentation transcript:

Grundaufbau import processing.core.PApplet; public class Proc_Minimal extends PApplet { public void setup(){ size(1024, 768); frameRate(60.0f); } public void draw() { background(255); fill(255,0,0); rectMode(CENTER); rect(mouseX, mouseY, 50, 50); } static public void main(String args[]) { //PApplet.main(new String[] { "--present", "Proc_Minimal" }); PApplet.main(new String[] {"Proc_Minimal" }); } Von Papplet ableiten Initialisierung Loop- Methode Create a Window

Wichtige Methoden/Attribute size(width, height) optional (width, height, Renderer) z.B. size(1024, 768, OPENGL) mouseX, mouseY pMouseX, pMouseY Größe d. Fensters + Renderer Aktuelle Mouseposition Mouseposition des letzten Frames

Zeichnen ellipse(x, y, width, height) auch: rect, triangle, line fill(grey) fill(r,g,b) fill(r,g,b,a); noFill() stroke(grey) // stroke(r,g,b) stroke(r,g,b,a) noStroke() strokeWeigth(pixel) colorMode(mode, range) colorMode(HSB. 255) //use hsv colorMode(HSB, hRange, sRange, vRange) background(128); fill(204, 102, 0); rect(30, 20, 55, 55); background(128); stroke(204, 102, 0); rect(30, 20, 55, 55); noStroke(); colorMode(HSB, 100); for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { stroke(i, j, 100); point(i, j); }

Transformationen transform(x, y) rotate(radiants) Use radiants(degree) to convert to radiants scale(factor)

Transformationen Why ? Because sometimes it‘s easier! void setup() { size(400, 100); background(255); for (int i = 10; i < 350; i = i + 50) { house(i, 20); } vs. void house(int x, int y) { triangle(x + 15, y, x, y + 15, x + 30, y + 15); rect(x, y + 15, 30, 30); rect(x + 12, y + 30, 10, 15); } 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(); }

Component-based Drawing public abstract class AbstractComponent { protected Vec2D center; protected float width, height; protected float angle; protected Color color; protected PApplet app; protected AbstractComponent parent; protected ArrayList addedComponents; public void preDraw(){ app.pushMatrix(); if (parent != null) app.rotate(-parent.getAngle()); app.translate(center.x, center.y); app.rotate(angle); } public void drawComponent(){ for (AbstractComponent ce : addedComponents) ce.drawComponent(); } public void postDraw(){ app.popMatrix(); } public abstract class AbstractComponent { public Vec2D getCenterGlobal() { if (parent == null) return center; else return parent.getCenterGlobal().add(center); }

Component-based Drawing public class OscilatorComponent extends AbstractComponent { public OscilatorComponent(Vec2D center, float width, …..) { super(center, float width,…); slider = new Slider(new Vec2D(), width/4*3, …); addedComponents.add(slider); public void drawComponent() { super.preDraw(); super.drawComponent(); app.rectMode(PApplet.CENTER); app.fill(color.r, color.g, color.b, color.a); app.noStroke(); app.rect(0, 0, width, height); super.postDraw(); }