Skip to content

Style rotate from 0 to 360 degrees and vice versa #3918

Answered by tomekzaw
JayNutZ asked this question in Q&A
Discussion options

You must be logged in to vote

How do i animate rotation degrees always using the closest direction? (via 360, 0... if optimal)

I'm afraid we don't have any built-in solution for this kind of animation but it sounds as it's fairly easy to implement on your own. Assuming that you always try to animate from $x$ deg to $y$ deg where $x, y \in [0, 360]$

  • if $x \leq y$, simply animate from $x$ to $y$
  • otherwise (i.e. $x > y$), animate from $x - 360$ (which is the same as $x$) to $y$

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@JayNutZ
Comment options

@tran-simon
Comment options

Answer selected by JayNutZ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants