Processing einf hrung
Download
1 / 6

Processing - Einführung - PowerPoint PPT Presentation


  • 52 Views
  • Uploaded on

Processing - Einführung. www.processing.org. 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);

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Processing - Einführung' - tadita


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Processing einf hrung

Processing - Einführung

www.processing.org


Grundaufbau
Grundaufbau

  • importprocessing.core.PApplet;

  • public class Proc_Minimal extends PApplet {

  • publicvoidsetup(){

  • size(1024, 768);

  • frameRate(60.0f);

  • }

  • publicvoiddraw()

  • {

  • 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
Wichtige Methoden/Attribute

Größe d. Fensters + Renderer

  • size(width, height)

    • optional (width, height, Renderer)

    • z.B. size(1024, 768, OPENGL)

  • mouseX, mouseY

  • pMouseX, pMouseY

Aktuelle Mouseposition

Mouseposition des letzten Frames


Zeichnen
Zeichnen

  • ellipse(x, y, width, height)

    • auch: rect, triangle, line

  • fill(grey)

  • fill(r,g,b)

  • fill(r,g,b,a);

  • noFill()

  • stroke(grey) // 0-255

  • stroke(r,g,b)

  • stroke(r,g,b,a)

  • noStroke()

  • strokeWeigth(pixel)

  • colorMode(mode, range)

    • colorMode(HSB. 255) //usehsv

    • 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
Transformationen

  • transform(x, y)

  • rotate(radiants)

    • Useradiants(degree) toconverttoradiants

  • scale(factor)


Transformationen1
Transformationen

Why ? Becausesometimesit‘seasier!

voidsetup() {

size(400, 100);

background(255);

for (int i = 10; i < 350; i = i + 50) {

house(i, 20);

}

}

voidhouse(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();

}

voidhouse(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);

}

vs.


ad