daimajia / daimajia/AnimationEasingFunctions

How to concatenate animations

Open
#19 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.5k
Forks
407
PR merge metrics
No merged PRs in 30d

Description

Hi, I want to know how to concatenate animations, I mean:

For example:
1. I have two list of animations. Each list contain animations to play together.
2.I want to execute secuencially, first the list one (play together) and then execute the list two (play together).

I'm trying to execute this situation using listeners, but I don't know why doesn't work. This is my code:

final Point distance = new Point(Math.abs(pointPlane.distace(pointImage1).getX()), Math.abs(pointPlane.distace(pointImage1).getY()));
AnimatorSet set = new AnimatorSet();
set.playTogether(
Glider.glide(Skill.Linear, 700, ObjectAnimator.ofFloat(imagePlane, "translationY", 0, -1 * distance.getY())),
Glider.glide(Skill.Linear, 700, ObjectAnimator.ofFloat(imagePlane, "translationX", 0, distance.getX()))
);
set.setDuration(2000);
set.start();
set.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {}

@Override
public void onAnimationEnd(Animator animator) {
imagePlane.setX(pointImage1.getX());
imagePlane.setY(pointImage1.getY());
final Point distance = new Point(Math.abs(pointPlane.distace(pointImage2).getX()), Math.abs(pointPlane.distace(pointImage2).getY()));
AnimatorSet set2 = new AnimatorSet();
set2.playTogether(
Glider.glide(Skill.Linear, 700, ObjectAnimator.ofFloat(imagePlane, "translationY", 0, 30)),
Glider.glide(Skill.Linear, 700, ObjectAnimator.ofFloat(imagePlane, "translationX", 0, 30))
);
set2.setDuration(2000);
set2.start();
}

@Override
public void onAnimationCancel(Animator animator) {}

@Override
public void onAnimationRepeat(Animator animator) {}
});

Thanks in advance!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.