Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private double angleInRadians = (float) (angle*Math.PI/180);
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_move);
- final MyCustomPanel view = new MyCustomPanel(this);
- ViewGroup.LayoutParams params =
- new ViewGroup.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
- LinearLayout.LayoutParams.FILL_PARENT);
- addContentView(view, params);
- findViewById(R.id.btB).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- //for (int i = 1; i <= 1000; i++) {
- x = (float) ( Math.sin(angle)*angleInRadians);
- y = (float) (Math.cos(angle)*angleInRadians);
- view.animate().x(x).y(y).setDuration(5000).start();
- //}
- }
- });
- //view.setOnTouchListener(this);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement