Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. private double angleInRadians = (float) (angle*Math.PI/180);
  2. @Override
  3. protected void onCreate(Bundle savedInstanceState) {
  4. super.onCreate(savedInstanceState);
  5. setContentView(R.layout.activity_move);
  6. final MyCustomPanel view = new MyCustomPanel(this);
  7.  
  8.  
  9. ViewGroup.LayoutParams params =
  10. new ViewGroup.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
  11. LinearLayout.LayoutParams.FILL_PARENT);
  12. addContentView(view, params);
  13. findViewById(R.id.btB).setOnClickListener(new View.OnClickListener() {
  14. @Override
  15. public void onClick(View v) {
  16.  
  17. //for (int i = 1; i <= 1000; i++) {
  18. x = (float) ( Math.sin(angle)*angleInRadians);
  19. y = (float) (Math.cos(angle)*angleInRadians);
  20. view.animate().x(x).y(y).setDuration(5000).start();
  21. //}
  22.  
  23.  
  24. }
  25. });
  26. //view.setOnTouchListener(this);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement