// --------------------------------------------------- // University of California Santa Barbara // Media Arts and Technology // MAT 259 | Visualizing Information | Winter 2011 // // Patrick Rudolph // Project 3 | Animation // // Checkout/explosion data structures // --------------------------------------------------- public class Checkout { float x,y; float w,h; float rot; int phase; float alpha; boolean active; public Checkout(float x,float y,float rot) { this.x = x; this.y = y; this.rot = rot; w = 4; h = 4; phase = 1; alpha = 55; active = true; } void draw() { pushMatrix(); rotate(rot); if(rot == 0) tint(#ffffa0,alpha); else tint(255,alpha); image(particle,x,y,w,h); noTint(); popMatrix(); } void animate() { if(phase == 1) { if(w < 10) { w+=3; h+=3; alpha += 100; } else { phase++; } } else if(phase == 2) { if(w > 0) { w -= 3; h -= 3; alpha -= 60; } else { phase++; } } else active = false; } }