Each Interpolation has it's own equation (linear, quadratic in, sinusiodal in-out, etc etc)

For linear, the general equation (using x and y since they're familiar) is:

y= a.x + c

For your range mapping [0,1] —> [-1,1], simultaneous equations can quickly tell us the values of a and c:
When x=0,  y=-1 ∴ c= -1 ie, y= a.x -1
For x=1, y=1 so substituting into y= a.x -1,
 1 = a*1 -1
⇔ a=2

So your equation for linear mapping of [0,1] —> [-1,1]
is y = 2.x -1,

Test our formula for x=0.5,
y = 2*0.5 -1
   = 0  ✔  It checks out ok!

Other general equations to use:

y = a(x+b)² +c          [Quadratic] or
y = a.x² +b.x + c       or
y = (x+a)(x+b) + c (Fixed the Typo present in the version I sent you earlier Oscar)
y = a.sin(x+b) +c       [Sinusoidal]
y = cb(x+a) + d         [Exponential] or
y = a.exp(x+b) + c      
y = a.x³ + b.x² + c.x +d        [cubic]

Solving some of these equations can be a bit more involved but mostly not to difficult by substituting in your range limits and mid-point or whatever. These should work for In-Out. In cases of just In or just Out you'll need two equations. One being say quadratic the other linear. Then switch from one equation to the other depending if x is < or ≥ the crossover point. I find Apples Grapher app (Utilities Folder) helps to visualise these equations. Many resources via wikipedia too.

Hope that helps
Alastair


On 04/01/2011, at 9:03 PM, Oscar 'offonoll' wrote:

Hello and happy new year!
I am wondering what is the Interpolation mathematical equation. as I normaly use it to transform a range of 0-1 (position) to my personal range such as -1 to 1.
thank you!!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com )
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/qc.student.au%40gmail.com

This email sent to qc.student...@gmail.com



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to