First time here? Check out the FAQ!

Ramping specific values with interpolateFrom: to:

+1 vote

How can I create ramps between two specific values set with interpolateFrom: to:?

So far I can only manage to create ramps that go from 0-1/1-0

and interpolateFrom: to: jumps straight to values but without ramping..



asked Oct 8, 2020 in Capytalk & Smalltalk by eli (Adept) (1,080 points)
edited Oct 8, 2020 by eli
Hi Eli, could you please give an example expression that jumps without interpolating? Thanks!

I have just attached a sound from the library as an example now.

Here, the Interpolation Value jumps to a new value between !Value0 and !Value1 according to the value of !Position.

This is exactly what I’m looking for but rather than having the !InterpValue jumping straight to the new value when changing !Position, I would like to create a ramp between the current !InterpValue and the new value when changing !Position.

Hope that makes sense..


1 Answer

+1 vote

One way to do this would be to smooth the receiver of the intepolateFrom:to: message. For example, you could do:

(!Position smooth: 5 s) interpolateFrom: !Value0 to: !Value1

answered Oct 9, 2020 by ssc (Savant) (113,610 points)

I was using ramp: instead of smooth:

That was my problem!

So what I have learned is:

ramp: is a linear function that increases from 0 to 1

smooth: transforms the discrete jumps in a controller value into a continuous linear interpolation from the previous value to the current value.