processing and programming n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Processing and Programming PowerPoint Presentation
Download Presentation
Processing and Programming

Loading in 2 Seconds...

play fullscreen
1 / 9

Processing and Programming - PowerPoint PPT Presentation


  • 106 Views
  • Uploaded on

Processing and Programming. B. Ramamurthy. Topics. 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. Program in Processing.

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

Processing and Programming


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 and programming

Processing and Programming

B. Ramamurthy

cse113-2013-2

topics
Topics

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

cse113-2013-2

program in processing
Program in Processing

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

cse113-2013-2

list of all commands
List of all commands

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

cse113-2013-2

a simple program house
A simple program (House)

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

cse113-2013-2

lets organize it
Lets Organize it

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

PImageimg= loadImage("Penguins.jpg");

image(img,0,0); }

cse113-2013-2

lets learn some commands 2d commands
Lets learn some commands: 2D commands

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

cse113-2013-2

color commands
Color commands

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

cse113-2013-2

mouse button
Mouse Button

mouseXmouseYmousePressedmouseReleased()mouseMoved()mouseDragged()

cse113-2013-2