Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Arjun Ganesan
Arjun Ganesan

Posted on

     

Transitions in Alexa with AnimateItem

Transitions are simple animations that provides visual feedback and enhances the pleasantness of the UI. By simply combining opacity, movement, scale and rotation we can create various types of transitions.

If you are new to transitions you can get some inspiration fromuimovement.com. Since the animations featured in the website is for web or mobile, not all can translate to a alexa animation but you can get some idea out of it.

Note: Always make sure the transitions are short and subtle.

This article will go through in detail on how to create some transitions withAnimateItem. If you are familiar with CSS Animations then AnimateItem works exactly the same with some limitations.

FadeIn

To create a fade in effect all we have to do is increase the opacity of the component from 0 to 1 gradually for a specific duration.

{"type":"AnimateItem","duration":1000,"value":[{"property":"opacity","from":0,"to":1}]}
Enter fullscreen modeExit fullscreen mode

FadeOut

FadeOut is similar to fade in but in reverse. Here we gradually reduce the opacity from 1 to 0.

{"type":"AnimateItem","duration":1000,"value":[{"property":"opacity","from":1,"to":0}]}
Enter fullscreen modeExit fullscreen mode

FadeInUp

Here the opacity needs to change from 0 to 1 and the component needs to move from bottom to top. So we manipulate both opacity and translate in Y axis

{"type":"AnimateItem","duration":1000,"value":[{"property":"opacity","from":0,"to":1},{"property":"transform","from":[{"translateY":"100%"}],"to":[{"translateY":"0"}]}]}
Enter fullscreen modeExit fullscreen mode

ZoomInDown

For this transition we manipulate opacity, scale on X & Y axis, translate on Y axis. This involves multiple AnimateItem executed in sequence. You will see an additional easing function here, rather than explaining what it does I will show a side by side comparison of the effect with and without the easing.

{"type":"Sequential","commands":[{"type":"AnimateItem","duration":600,"easing":"cubic-bezier(0.55, 0.055, 0.675, 0.19)","value":[{"property":"opacity","from":0,"to":1},{"property":"transform","from":[{"scaleX":0.1,"scaleY":0.1},{"translateY":"-100vh"}],"to":[{"scaleX":0.475,"scaleY":0.475},{"translateY":"60px"}]}]},{"type":"AnimateItem","duration":400,"easing":"cubic-bezier(0.175, 0.885, 0.32, 1)","value":[{"property":"transform","from":[{"scaleX":0.475,"scaleY":0.475},{"translateY":"60px"}],"to":[{"scaleX":1,"scaleY":1},{"translateY":"0"}]}]}]}
Enter fullscreen modeExit fullscreen mode

Adding a easing function enhances the transitions. AnimateItem supports both linear and cubic-beizier functions. Checkeasings.net to know the types of easing that can be generated with cubic-bezier and how it actually affects the transition.

Conclusion

Similar to the above examples you can create different variation of transitions. I have created a repo of few transitions which you can use in your skillshttps://github.com/arjun-g/apl-transitions. Instructions on how to use it can be found in the repo. Fade On!!!!!

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Location
    Chennai
  • Work
    Chief Developer
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp