- class Blip{
- float x, y;
- int redness;
- Blip(float x, float y){
- this.x=x;
- this.y=y;
- redness=0;
- }
- void draw(){
- if( redness < 256 ) redness+=5;
- fill(redness, 0, 0);
- ellipse(x,y,10,10);
- }
- }
- ArrayList blips = new ArrayList();
- float lastX, lastY;
- void setup(){
- size(400,400);
- smooth();
- noStroke();
- lastX = width / 2.0;
- lastY = height / 2.0;
- ellipseMode(CENTER);
- }
- void draw(){
- background(0);
- for( int i = 0; i < blips.size(); i++ ){
- Blip temp = (Blip) blips.get(i);
- temp.draw();
- }
- }
- void mouseClicked(){
- lastX = (lastX + mouseX) / 2.0;
- lastY = (lastY + mouseY) / 2.0;
- blips.add( new Blip( lastX, lastY ) );
- }
↧
Re : animation pausing
↧