开发者

General easing algorithms (Not for sepecific GUI API)

开发者 https://www.devze.com 2023-03-08 07:01 出处:网络
I\'m developing a control program for a Quadrocopter (AR Drone) under C# I want to ease the input from keyboards (Which do not have axes like joysticks)...

I'm developing a control program for a Quadrocopter (AR Drone) under C# I want to ease the input from keyboards (Which do not have axes like joysticks)...

So i need a collection of methods that the user 开发者_开发百科can choose from with different kind of easings.


Made these simplified algorithms to filter any kind of normalized signal.

http://github.com/eppz/eppz.easing

General easing algorithms (Not for sepecific GUI API)

// Linear
y = x

// Ease_In
y = x^2

// Ease_In_2
y = x^3

// Ease_In_3
y = x^8

// Ease_Out
y = 1-(1-x)^2

// Ease_Out_2
y = 1-(1-x)^3

// Ease_Out_3
y = 1-(1-x)^8

// Ease_In_Out
y = (x<0.5) ? (2x)^2/2 : 0.5+(1-(2(1-x))^2)/2
y = (x<0.5) ? 2x^2 : -2x^2+4x-1

// Ease_In_Out_2
y = (x<0.5) ? (2x)^3/2 : 0.5+(1-(2(1-x))^3)/2
y = (x<0.5) ? 4x^3 : 4x^3-12x^2+12x-3

// Ease_In_Out_3
y = (x<0.5) ? (2x)^8/2 : 0.5+(1-(2(1-x))^8)/2
y = (x<0.5) ? 128x^8 : 0.5+(1-(2(1-x))^8)/2

// Ease_In_Circular
y = 1-sqrt(1-x^2)

// Ease_Out_Circular
y = sqrt(1-(1-x)^2)
y = sqrt(-(x-2)x)

// Ease_In_Out_Circular
y = (x<0.5) ? (1-sqrt(1-(2x)^2))/2 : 0.5+sqrt(1-((2(1-x))^2))/2
y = (x<0.5) ? 0.5(1-sqrt(1-4x^2)) : 0.5(sqrt(-4(x-2)x-3)+1)

// Ease_In_Bounce
y = 2x^3-x^2
y = x^2(2x-1)

// Ease_In_Bounce_2
y = 3x^3-2x^2
y = x^2(3x-2)

// Ease_In_Bounce_3
y = 4x^3-3x^2
y = x^2(4x-3)

// Ease_Out_Bounce
y = 1-(2(1-x)^3-(1-x)^2)
y = x(x(2x-5)+4)

// Ease_Out_Bounce_2
y = 1-(3(1-x)^3-2(1-x)^2)
y = x(x(3x-7)+5)

// Ease_Out_Bounce_3
y = 1-(4(1-x)^3-3(1-x)^2)
y = x(x(4x-9)+6)

// Ease_In_Out_Bounce
y = (x<0.5) ? (2(2x)^3-(2x)^2)*0.5 : 1-(2(2(1-x))^3-(2(1-x))^2)*0.5
y = (x<0.5) ? 8x^3-2x^2 : 8x^3-22x^2+20x-5

// Ease_In_Out_Bounce_2
y = (x<0.5) ? (3(2x)^3-2(2x)^2)*0.5 : 1-(3(2(1-x))^3-2(2(1-x))^2)*0.5
y = (x<0.5) ? 12x^3-4x^2 : 12x^3-32x^2+28x-7

// Ease_In_Out_Bounce_3
y = (x<0.5) ? (4(2x)^3-3(2x)^2)*0.5 : 1-(4(2(1-x))^3-3(2(1-x))^2)*0.5
y = (x<0.5) ? 16x^3-6x^2 : 16x^3-42x^2+36x-9


iTween has quite a few of them and it's under the MIT license. You could try borrowing some from there.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号