processing variables
Download
Skip this Video
Download Presentation
Processing Variables

Loading in 2 Seconds...

play fullscreen
1 / 8

Processing Variables - PowerPoint PPT Presentation


  • 82 Views
  • Uploaded on

Processing Variables. Variables. Processing gives us several variables to play with These variables are always being updated and you can assume they have the right value Watch your spelling!. Mouse Location. mouseX tells the X location of the mouse mouseY tells the Y location of the mouse.

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 Variables' - amanda


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
variables
Variables
  • Processing gives us several variables to play with
  • These variables are always being updated and you can assume they have the right value
  • Watch your spelling!
mouse location
Mouse Location
  • mouseX tells the X location of the mouse
  • mouseY tells the Y location of the mouse
window properties
Window Properties
  • width tells the width of the window currently (even if you resize)
  • height tells the current height of the window

height

width

what can you do with that
What can you do with that?
  • Draw a circle that follows the mouse:
    • ellipse(mouseX, mouseY, 20, 20);
  • Draw a rectangle (60x40) centered around the mouse:
    • rect(mouseX-30, mouseY-20, 60,40);
  • Draw a box, centered, exactly ½ the size of the window:
    • rectMode(CENTER);
    • rect(width/2, height/2, width/2, height/2);
coding with methods
Coding with methods
  • Notice the “chunks” of code, like setup and draw:

public void draw(){

<- Code goes in here.

}

coding with methods1
Coding with methods
  • Notice the “chunks” of code, like setup and draw:

public void draw(){

<- Code goes in here.

}

We can make our own:

public void drawEyes(){

ellipse(50,50,10,10);

ellipse(20,50,10,10);

}

coding with methods2
Coding with methods
  • Notice the “chunks” of code, like setup and draw:

public void draw(){

drawEyes(); Now call the method in

} the draw() section.

We can make our own:

public void drawEyes(){

ellipse(50,50,10,10);

ellipse(20,50,10,10);

}

ad