How to apply easing animation function on view in Android

后端 未结 5 2052
情深已故
情深已故 2020-12-14 04:11

I want to apply a translate animation on an Android view (button) using a custom interpolator where the easing function is:

         


        
5条回答
  •  盖世英雄少女心
    2020-12-14 04:39

    1,2,3 go

    1. Create a custom cubic bezier curve using this awesome site. And get the control points for the curve. Between 0,0 and 1,1
    2. Interpolator customInterpolator = PathInterpolatorCompat.create(cpX1,cpX2,cpY1,cpY2)
    3. Add this customInterpolator to any of your animation.

    Added a gist. Some more here.

提交回复
热议问题