Upcoming SlideShare
×

# Programming for Artists and Designers: Week 2

655 views

Published on

Slides for the 2nd week of an introductory Processing course at the V&A

Published in: Lifestyle
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
655
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
12
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Programming for Artists and Designers: Week 2

1. 1. Week 2: Fundamentals of Programming Variables, Arrays, For Loops, If Statements
2. 2. int centerX = 320; variables
3. 3. variables
4. 4. variables
5. 5. variables do not change can change
6. 6. variables
7. 7. a short break: println and detecting the mouse println ( mouseX + “ ” + mouseY );
8. 8. a short break: width and height ellipse ( width /2, height /2,100,100);
9. 9. arrays int [] centerX = new int [10];
10. 10. int [] centerX = { 0,0,1,1,2,2,3,3,4,4 }; arrays
11. 11. int [] centerX = new int [10]; arrays centerX[0]=0; centerX[1]=0; centerX[2]=1; centerX[3]=2; …and so on void setup (){
12. 12. int [] centerX = new int [10]; arrays… and for loops for ( int i = 0; i < 10; i++){ centerX[i] = i/2; } void setup (){ }
13. 13. for loops void setup (){ blahblahblah(); } void draw (){ blahblah(); for ( int i = 0; i < 20; i++){ blahblahblah(); blah[i] = blah[i] +1; } blahblah(); }
14. 14. if… else if ( mousePressed == true ){ do something; } else if ( keyPressed == true ){ do something else; } else { do something else; }
15. 15. if… else if (centerX < width /2){ do something; } else if (centerX >= 3* width /4){ do something else; } else { do something else; }