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

**Posts:**1,766**Reputation:**19,190

B

134
S

65
G

16
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:**929**Reputation:**8,430

B

52
S

13
G

7
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

https://www.scirra.com/forum/viewtopic.php?t=152506

And that is why you shall respect the bug reports guidelines, not only giving a capx is making the bug reproductible in one click in a situation they can work with (less time wasted trying to reproduce vague instructions) but also it helps filtering false positives.

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

And that is why you shall respect the bug reports guidelines, not only giving a capx is making the bug reproductible in one click in a situation they can work with (less time wasted trying to reproduce vague instructions) but also it helps filtering false positives.

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

**Posts:**2,094**Reputation:**15,355

B

42
S

17
G

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

## Who is online |

Users browsing this forum: No registered users and 8 guests |