python的基本宽松函数集合
easing-functions的Python项目详细描述
放松功能
penner为python编写的宽松函数的集合
该系列包括以下Ease In/Ease Out和Ease InOut:
Quadratic (Quad), Cubic, Quartic, Quintic, Sine, Circular, Exponential, Elastic, Back, Bounce, Linear
要安装:
pip install easing-functions
使用:
fromeasing_functionsimport*# For a duration 10 you will get the relevant output from start to enda=QuadEaseInOut(start=0,end=3,duration=10)k=a.ease(4)# 4 is a number between 0 and the duration you specified#k is the returned value from start to end (0 to 3)# example plots:importnumpyasnpimportmatplotlib.pyplotasplta=BounceEaseInOut(start=3,end=1,duration=1)b=BounceEaseIn(start=0,end=1)c=BounceEaseOut(start=0,end=1)x=np.arange(0,1,0.001)y0=list(map(a.ease,x))y1=list(map(b.ease,x))y2=list(map(c.ease,x))plt.plot(x,y0)plt.plot(x,y1)plt.plot(x,y2)