daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest May 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    public class CircleAnimation implements Animation {
  2.  
  3.         int radius;
  4.         int framesPerRotation;
  5.  
  6.         private CircleAnimation(int radius, int framesPerRotation) {
  7.             this.radius = radius;
  8.             this.framesPerRotation = framesPerRotation;
  9.         }
  10.  
  11.         public void animate(int frame) {
  12.             double angle = 2 * Math.PI / framesPerRotation;
  13.             Figure.this.setX(Figure.this.getX() + (int) (Math.cos((frame * angle) * radius) * 10));
  14.             Figure.this.setY(Figure.this.getY() + (int) (Math.sin((frame * angle) * radius) * 10));
  15.         }
  16.     }
RAW Paste Data
Top