

It gives more control over the animation’s motion. The last piece of the MotionLayout puzzle is the key frameset. The second way is to use the pathMotionArc parameter.Īs you can see we’ve added motion:pathMotionArc="startVertical" to the starting constraint. Material design guidelines often recommend using arc motion in animations as it’s more natural. can be also used for already defined view properties like backgroundColor. To create a custom attribute, you need to define a variable with public getter and setter in a custom view and then pass its name as motion:attributeName. Circle radius will be changing its value from 0 to 1 while the animation progresses. This scene is very similar to the last one. HandleView is the only view in our MotionLayout. Our layout will be very basic once again. We will modify this variable to animate circle size. This custom view paints a blue circle with a radius dependent on the radius variable. All transitions and animations might be described purely in xml.īefore we start playing with MotionLayout, we need to add suitable dependencies to a project. The amazing thing about MotionLayout is that it’s fully declarative.

The difference is that MotionLayout builds upon its capabilities - we can now describe layout transitions and animate view properties changes. We can define and constraint children just like we would do when using standard ConstraintLayout. So, what’s the MotionLayout? Simply put, MotionLayout is a Viewgroup that extends ConstraintLayout.
