Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. x=500, y=100, width=200, height=500, pivotX=100, pivotY=400
  2.  
  3. x=450, y=150, width=100, height=400, pivotX=50, pivotY=50
  4.  
  5. var radians = (Math.PI / 180) * red.degree;
  6. green.x += red.pivotX * Math.cos(radians) - red.pivotY * Math.sin(radians);
  7. green.y += red.pivotX * Math.sin(radians) + red.pivotY * Math.cos(radians);
  8.  
  9. vx = green.x + green.pivotX - red.x - red.pivotX;
  10. vy = green.y + green.pivotY - red.y - red.pivotY;
  11.  
  12. wx = Math.cos(radians)*vx - Math.sin(radians)*vy;
  13. wy = Math.sin(radians)*vx + Math.cos(radians)*vy;
  14.  
  15. green.x += wx - vx;
  16. green.y += wy - vy;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement