Android Open Source - andQuery Spiral Animation






From Project

Back to project page andQuery.

License

The source code is released under:

MIT License

If you think the Android project andQuery listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.codingg.andquery.Animation;
//from  www .j  ava 2s. c o m
import android.graphics.Point;

/**
 * Created by sanjav on 1/25/15.
 */
public class SpiralAnimation extends TrajectoryAnimation {
    float radius = 1;
    float angle = 0;
    float divergence = 1;
    int moves = 0;

    public SpiralAnimation(Point startPoint, float divergence, float speed, float refinement) {
        super(startPoint, speed, refinement);
        this.divergence = divergence;
    }

    @Override
    public float getX(float currX, float currY) {
        double x = startPoint.x + (radius * Math.cos(Math.toRadians(angle)));
        angle += speed;
        radius += divergence;

        return (float) x;
    }

    @Override
    public float getY(float currX, float currY) {
        double y = startPoint.y + (radius * Math.sin(Math.toRadians(angle)));
        return (float) y;
    }

    @Override
    public void onTerminate() {

    }

    @Override
    public boolean terminationCondition() {
        if (moves == 2000) {
            return true;
        }
        moves++;

        return false;
    }
}




Java Source Code List

com.codingg.andquery.ApplicationTest.java
com.codingg.andquery.Animation.Animation.java
com.codingg.andquery.Animation.CircleAnimation.java
com.codingg.andquery.Animation.GameLoop.java
com.codingg.andquery.Animation.MoveAnimation.java
com.codingg.andquery.Animation.SpiralAnimation.java
com.codingg.andquery.Animation.TrajectoryAnimation.java
com.codingg.andquery.Animation.xView.xImageView.java