Defining more than two values in animations

You must Login before you can answer or comment on any questions.

In animation, it looks like you can only define two values - the start value and the end value. Is there a way to add more values? For example, in a course of an animation you want the opacity to start from 0 to 1 and back to 0 (3 defined values). This will look like it's fading in then out in one animation.

Anyone figured out a way to do this?

2 Answers

Accepted Answer

You can accomplish this with the animations complete event. On the complete event you would just call another animation that returns the opacity back to 1. The example in the docs shows how to use this and i think it would suit your needs here.

Doc Link

— answered 9 months ago by Christopher Carranza
answer permalink
1 Comment
  • Yeah. This is what I ended up doing. Chaining several animations together with complete callback seems to work fine. Thanks a lot.

    — commented 9 months ago by Charles Ko

Hey you can try using a property of animation i.e., autoreverse set it to true.

And your work is done :)

— answered 9 months ago by Veer Jain
answer permalink
1 Comment
  • Thanks for the tip. It works for the example I gave above, but if it's slightly more complex it won't work.

    — commented 9 months ago by Charles Ko

Your Answer

Think you can help? Login to answer this question!