Posts

Showing posts from July, 2020

Planet Animation

1. Put this code in (on create) PlanetView bcv = new PlanetView(this); linear1.addView(bcv); 2. Make Moreblock and name it (extra) put this code }  public class PlanetView extends View {  private double angle=0; private Paint myPaint;  public PlanetView(Context context){  super(context);  myPaint = new Paint();  angle = 0;  }  @Override protected void onDraw(Canvas canvas) {  int viewWidth = this.getMeasuredWidth();  int viewHeight = this.getMeasuredHeight(); angle = (angle + 0.001)%360;  float x = Math.round(260*Math.sin(Math.toDegrees(angle)));  float y = Math.round(110*Math.cos(Math.toDegrees(angle)));  float x2 = Math.round(120*Math.sin(90+Math.toDegrees(angle)));  float y2 = Math.round(290*Math.cos(90+Math.toDegrees(angle)));  float x3 = Math.round(130*Math.sin(180+Math.toDegrees(angle)));  float y3 = Math.round(230*Math.cos(180+Math.toDegrees(angle))); float x4 = Math.round(120*Math.sin(270+Math.toDegr...