[MUSIC PLAYING]
SPEAKER: Welcome to the Motion Tags series.
In this series of short videos, we'll
cover all the tags associated with MotionLayout.
Today, we're going to talk about KeyTriggers.
MotionLayout allows you to think of animations
as a layer on top of your UI or an integral part of your UI.
You can choose based on the needs of your application.
But sometimes, you need callbacks back into your code.
And KeyTrigger allows that.
It calls the onTransitionTrigger method
of the addTransitionListener.
KeyTrigger has the same motionTarget and framePosition
as other key frames.
But triggerID is useful to identify your trigger
to the callback.
In general, KeyTriggers don't generate any UI on the screen
but can be used to allow your application
to control the animation.
The interaction shown here needs KeyTriggers
to achieve the desired effect.
In this case, KeyTrigger is directly
calling the show and hide methods
of the material components floating action button.
It can directly call simple methods
on a view using three attributes--
onCross, onPositiveCross, and onNegativeCross.
These attributes cause the message
to be called when crossing the key position point.
We'll be adding more functionality to KeyTriggers
in 2.1.
So stay tuned.
Congratulations.
You made it all the way through the Motion Tags series.
Thank you for sticking with us.
We really hope you enjoyed the series.
The library is being developed directly on GitHub.
So check out constraint layout on GitHub.
The link is in the description.
Enjoy some highlights of the entire series.
[MUSIC PLAYING]