15 posts
• Page **2** of **2** • 1, **2**

**Posts:**1,777**Reputation:**21,702

B

143
S

72
G

19
R0J0hound wrote: Here are the formulas:

qarp(a, b, c, t) = lerp(lerp(a,b,t), lerp(b,c,t), t)

cubic(a, b, c, d, t) = lerp(qarp(a,b,c,t), qarp(b,c,d,t), t)

cosp(a, b, t) = (a+b+(a-b)*cos(t*180))/2

thanks @R0J0hound

When I've use lerp to move sprites it seems to have built in "slow down" toward the end which is great. If I wanted this "slow down" at the beginning and the ending would I use qarp? (or your lerp(lerp(a,b,t), lerp(b,c,t), t)). I tried it when zooming out the layout and it doesn't seem to work like I expected...still feels like a regular old lerp.. since it starts zooming fast then gradually slows.

- Code: Select all
`Set Layout scale to lerp(lerp(LayoutScale,1,0.5*dt), lerp(1,4,0.5*dt), 0.5*dt)`

a=LayoutScale (which starts at 1.3)

b=1

c=4 (wasn't sure how steep to make the curve)

t=0.5*dt

Steam: http://steamcommunity.com/sharedfiles/f ... =642927367 Construct 2 Creations Forum: viewtopic.php?f=180&t=170072

**Posts:**1,143**Reputation:**14,981

B

88
S

29
G

14
jobel wrote:R0J0hound wrote: Here are the formulas:

qarp(a, b, c, t) = lerp(lerp(a,b,t), lerp(b,c,t), t)

cubic(a, b, c, d, t) = lerp(qarp(a,b,c,t), qarp(b,c,d,t), t)

cosp(a, b, t) = (a+b+(a-b)*cos(t*180))/2

thanks @R0J0hound

When I've use lerp to move sprites it seems to have built in "slow down" toward the end which is great. If I wanted this "slow down" at the beginning and the ending would I use qarp? (or your lerp(lerp(a,b,t), lerp(b,c,t), t)). I tried it when zooming out the layout and it doesn't seem to work like I expected...still feels like a regular old lerp.. since it starts zooming fast then gradually slows.

- Code: Select all
`Set Layout scale to lerp(lerp(LayoutScale,1,0.5*dt), lerp(1,4,0.5*dt), 0.5*dt)`

a=LayoutScale (which starts at 1.3)

b=1

c=4 (wasn't sure how steep to make the curve)

t=0.5*dt

The "built in slowdown" comes from the use of lerp you are using, a is the variant in your case, so you have a "suite arithmétique" (not sure of the english term for that), that will go slower and slower towards the point. (it shouldn't even reach it, I never understood why people are using lerp like this)

To be exact, lerp(a, b, x) return the value between a and b, corresponding to the percentage (reminder of math: 1 = 100%) x, from a to b

lerp(a,b, 0) will return a, lerp(a, b, 1) will return b, lerp(a, b, 0.5) will return (a+b)/2.

The intended use is to make x varie (generally from 0 to 1, but it can go over that), for your zoom, you can have lerp(min value, max value, zoom percentage), and make the zoom percentage varying from 0 to 1 or 1 to 0 as you want it.

The qarp will be the same logic, but applied not in a linear fashion (a quadratic one, which I think means that a and c will be min and max, but b will be affecting the way it evolves with each values of t)

qarp (a, b, c, 0) will return a, qarp(a, b, c, 1) will return c, qarp (a, b, c, 0.5) will return ((a+b)/2+(b+c)/2)/2 = ((a+c)/2+b)/2 I think

Game design is all about decomposing the core of your game so it becomes simple instructions.

**Posts:**2,122**Reputation:**17,093

B

52
S

22
G

18
15 posts
• Page **2** of **2** • 1, **2**

## Who is online |

Users browsing this forum: No registered users and 1 guest |