Kwp2 100114

925 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
925
On SlideShare
0
From Embeds
0
Number of Embeds
21
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Kwp2 100114

    1. 1. void setup(){ size(400,400); } void draw(){ background(0,0,0); fill(31,127,255); stroke(255,255,255); translate(width/2, height/2); rotate(30); rect(-100,-100,200,200); }
    2. 2. void setup(){ size(400,400); } void draw(){ background(0,0,0); fill(31,127,255); stroke(255,255,255); pushMatrix(); translate(100, 100); rotate(30); rect(-50,-50,100,100); popMatrix(); pushMatrix(); translate(300, 300); rotate(10); rect(-50,-50,100,100); popMatrix(); }
    3. 3. // float aSpeed, angle; boolean pressed; // void setup(){ size(400,400); frameRate(30); noStroke(); aSpeed = 0; angle = 0; pressed = false; } // void draw(){ background(0); pushMatrix(); translate(width/2, height/2); rotate(angle); fill(31,127,255); rect(-100,-100,200,200); popMatrix();
    4. 4. angle += aSpeed; if(pressed){ aSpeed += 0.01; } else if(aSpeed>0) { aSpeed -= 0.02; } else { aSpeed = 0; } } // void mousePressed(){ pressed = true; } // void mouseReleased(){ pressed = false; }
    5. 5. // float aSpeed, angle; boolean pressed; // void setup(){ size(400,400); frameRate(30); noStroke(); aSpeed = 0; angle = 0; pressed = false; } // void draw(){ background(0); pushMatrix(); translate(width/2, height/2); rotate(angle); fill(255,255,255); rect(-400,-400,400,400); rect(0,0,400,400); fill(0,0,0); rect(-400,200,400,400);
    6. 6. angle += aSpeed; if(pressed){ aSpeed += 0.01; } else if(aSpeed>0) { aSpeed -= 0.02; } else { aSpeed = 0; } } // void mousePressed(){ pressed = true; } // void mouseReleased(){ pressed = false; }

    ×