Your SlideShare is downloading. ×
0
Bootcamp - Team TEAL - Day 7
Bootcamp - Team TEAL - Day 7
Bootcamp - Team TEAL - Day 7
Bootcamp - Team TEAL - Day 7
Bootcamp - Team TEAL - Day 7
Bootcamp - Team TEAL - Day 7
Bootcamp - Team TEAL - Day 7
Bootcamp - Team TEAL - Day 7
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Bootcamp - Team TEAL - Day 7

868

Published on

Mouse and keyboard interaction!

Mouse and keyboard interaction!

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
868
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. TEA M TEAL LIZ RUTLEDGEDAY 7 rutle173@newschool.eduAugust 9, 2011 esrutledge@gmail.com
  • 2. agenda. Review: Learn: All that hard stuff that just MOUSE INTERACTION! keeps ACCUMULATING! (yayyyyyyyyy) namely: namely: if-statements mouseX, mouseY conditional operators pmouseX, pmouseY nested if-statements mousePressed the dreaded for loop mouseReleasedDAY 7Tuesday, 9 Aug 2011 CODE bootcamp 2011
  • 3. homework now wasn’t that fun? the for-loop parade: questions? let’s look at a few! review: the structure of a for loop why we use for loops anything else?DAY 7Tuesday, 9 Aug 2011 CODE bootcamp 2011
  • 4. mouse interaction! finally the good stuff! the concept: actually being able to include user input in your sketch through the position and activity of their mouse and keyboardDAY 7Tuesday, 9 Aug 2011 CODE bootcamp 2011
  • 5. mouse position. home is where their mouse is. the syntax: mouseX, mouseY the location of the user’s mouse pmouseX, pmouseY the location of the user’s mouse exactly one loop ago note: this allows you to very easily get the CHANGE in mouse position (i.e. which direction the user is moving his/her pointer)DAY 7Tuesday, 9 Aug 2011 CODE bootcamp 2011
  • 6. mouse inputs. clicks, drags, movements, etc. variables. mousePressed (boolean) tells you if the mouse button is pressed mouseButton variable that tells you which button was clicked (LEFT or RIGHT) functions. these allow you to create entire series of events every time corresponding condition has occurred mousePressed() mouseReleased() mouseDragged() mouseMoved() mouseClicked()DAY 7Tuesday, 9 Aug 2011 CODE bootcamp 2011
  • 7. keyboard inputs. variables. keyPressed (boolean) whether or not a key (any key) is pressed } only useful inside key which key is being pressed (ex: ‘a’, ‘b’, ‘B’, ‘x’, ‘ ‘ ) as string one of the below functions or an if- keyCode which key is being pressed if a non-ASCII key as a CODE statement testing for keyPressed (ex: BACKSPACE, TAB, ENTER, RETURN, ESC, and DELETE) functions. these allow you to create entire series of events every time corresponding condition has occurred keyPressed() keyReleased() keyTyped()DAY 7Tuesday, 9 Aug 2011 CODE bootcamp 2011
  • 8. homework. due Wednesday, August 10pth. do: Keyboard and Mouse Interaction: Googly Eyes! Create a pair of eyes that react to mouse/key input. (ex: Eyes follow your mouse wherever it goes, the eyes blink when you click, and anything else you can think of.) There are two possible versions you can do of this project depending on your comfort level with trigonometry: 1. The “Boooo Trig” Version: Make the eyes rectangles or square and use the constrain() function to limit the pupil position 2. The “Yay Trig!” Version: Make the eyes circular and calculate the positions of the eyes using dist(), sin(), cos(), and acos() or asin(). You might also be able to use the constrain() function based on your approach. extra credit: Square Painter! Create three distinct types of squares to draw (differing in size, fill color, etc) and link each one to a keyboard command (a key or keyCode). The user should be able to press a key to “load their paintbrush” with each one of the square styles and draw them wherever they click like a stamp.DAY 7Tuesday, 9 Aug 2011 CODE bootcamp 2011

×