Tiffany - K

By Tiffany
// Thank you, Andres! Cow teddy; Cow tiffany; PShape body; PShape head; void setup() { size(400, 400); noStroke(); smooth(); body = loadShape("body.svg"); head = loadShape("head.svg"); tiffany = new Cow(200, 300, 0.5, .9, 0.03); teddy = new Cow(200, 200, .8, 0.2, 0.01); } // end void setup void draw() { background (61, 151, 21); tiffany.display(); tiffany.move(); teddy.display(); teddy.move(); } // end void draw; class Cow { float x; float y; float e; float s; float b; float tilta; float tiltb; float a; Cow (float xpos, float ypos, float bigness, float speed, float easing) { x = xpos; y = ypos; s = speed; e = easing; b = bigness; } void display() { // Top triangle //triangle(-20, -8, 20, 0, -20, 8); float angle = atan2(mouseY-y, mouseX-x); tilta = cos(a)/32; tiltb = sin(a)/16; a += 0.1; pushMatrix(); translate(x, y); rotate(angle); rotate(tilta); shape(body, 0, 0, 89*b, 56*b); rotate(tiltb); shape(head, 89*b, -8*b, 38*b, 71*b); popMatrix(); } void move() { x += ((mouseX - x)* e) * s; y += ((mouseY -y) * e) * s; } }

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*