Download presentation
Presentation is loading. Please wait.
Published byAugusta Scott Modified over 9 years ago
1
B. RAMAMURTHY Processing and Programming cse113-2013-2 1
2
Topics cse113-2013-2 2 Lets understand some of the processing primitives “commands” or “instructions” Format of commands Grouping of commands into coherent functions Parameterizing the commands Sample commands: lets learn some commands
3
Program in Processing cse113-2013-2 3 A program in Processing language is a collection of one or more commands Format of a command: Keyword Parenthesis Arguments or parameters Semicolon terminating the command Example: size(400,400);
4
List of all commands cse113-2013-2 4 Reference to all the Processing commands is available at http://processing.org/reference It is also available in the Help menu of your Processing environment
5
A simple program (House) cse113-2013-2 5 size(400, 600); rect(50,250,300,300); triangle(50,250,350,250,200,50); rect(175,450,50,100); ellipse(185,515,6,6); rect(85,300,40,40); rect(130,300,40,40); rect(85,340,40,40); rect(130,345,40,40); rect(230,300,40,40); rect(275,300,40,40); rect(230,345,40,40); rect(275,345,40,40); ellipse(20,20,30,30);
6
Lets Organize it cse113-2013-2 6 A program as a collection of functions/methods void setup() { size(1400,1400); stroke(0); } void draw() { line(40,50, mouseX, mouseY); } void mousePressed() { background(192,64,0); stroke(255); PImage img= loadImage("Penguins.jpg"); image(img,0,0); }
7
Lets learn some commands: 2D commands cse113-2013-2 7 point (x, y); line(x1,y2,x2,y2); triangle(x1,y1, x2,y2, x3,y3); rect(x,y, length, width); // when length = width we get square ellipse(x, y, width, height); //when width=height we get circle arc(x,y,width, height, start, stop); quad(x1,y1, x2, y2, x3, y3, x4,y4);
8
Color commands cse113-2013-2 8 background(single color #);// # between 0-255 background(r, g, b); // complex color background(img); fill(color); // sets fill color in RGB stroke(color);//sets the line color
9
Mouse Button cse113-2013-2 9 mouseX mouseY mousePressed mouseReleased() mouseMoved() mouseDragged()
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.