Android Open Source - andQuery Trajectory 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  ww w. ja  va2  s.  co m*/
import android.graphics.Point;

/**
 * Created by sanjav on 1/24/15.
 */
public abstract class TrajectoryAnimation extends Animation {
    public Point startPoint;

    private float currY  = 0;
    private float currX  = 0;

    @Override
    public void onIterate() {
        currX = getX(currX, currY);
        currY = getY(currX, currY);

        updateViewLocation(currX, currY);
    }

    @Override
    public void begin() {
        currX = startPoint.x;
        currY = startPoint.y;

        onIterate();
    }

    public abstract float getX(float currX, float currY);
    public abstract float getY(float currX, float currY);

    public TrajectoryAnimation(Point startPoint, float speed) {
        this.startPoint = startPoint;

        setSpeed(speed);
    }

    public TrajectoryAnimation(Point startPoint, float speed, float refinement) {
        this.startPoint = startPoint;

        setRefinement(refinement);
        setSpeed(speed);
    }

    public void resetParameters(Point startPoint, float speed, int refinement) {
        this.startPoint = startPoint;
        setSpeed(speed);
        setRefinement(refinement);
        this.isTerminated = false;
    }

    @Override
    public boolean terminationCondition() {
        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