Jump to: Board index » General » Fusion

Linear Interpolation in Fusion

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

RobertCameron

  • Posts: 1
  • Joined: Sat Mar 21, 2020 10:32 am
  • Real Name: RobertCameron

Linear Interpolation in Fusion

PostSat Mar 21, 2020 10:33 am

Coming from AE, I use the expression "linear" all the time to interpolate one set of values based on the values of another variable. So, if "layer 1" moved from the left side of the screen to the right, and I wanted to scale "layer 2" based on "layer 1's" x position, I'd use "linear(layer1.xposition, layer 1 min value, layer 1 max value, new min, new max). Forgive the syntax, I know it's all wrong, just trying to get the point across.

Is there a similar expression I could use in Fusion? I'm on a journey of learning Lua, but this is a problem I need to solve asap.

Thanks!
Offline

UserNoah

  • Posts: 16
  • Joined: Fri Oct 04, 2019 3:32 pm
  • Location: Berlin
  • Real Name: Noah Hähnel

Re: Linear Interpolation in Fusion

PostThu Mar 26, 2020 7:47 am

This is possible. For most parameters you can right click and modify them. Either by connecting them to another tool parameter or by an expression. You probably want to use expression.
I'm not in front of fusion right now so I don't want to give you any code I didn't test out. There is the Fusion 8 scripting guide that should tell you which ones to use.
Offline
User avatar

Bryan Ray

  • Posts: 1319
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Linear Interpolation in Fusion

PostThu Mar 26, 2020 3:27 pm

The basic linear interpolation expression is this:
MaxValue * control + MinValue * (1-control)

So if you wanted a Scale slider to go from 0.25 - 0.75 when Transform1's Center control moved from 0 to 1 in X, the expression would look like this:

0.75 * Transform1.Center.X + 0.25 * (1-Transform1.Center.X)

Conveniently, Fusion's coordinate space is already based on percentage of screen width, so you usually don't need to normalize that range, as you would in AE, where the screen is measured in pixels.

For anything more complex, take a look at this in-development Fuse/Script/I-don't-know-where-it's-going at We Suck Less:
https://www.steakunderwater.com/wesuckl ... =45&t=3723
Bryan Ray
http://www.bryanray.name
http://www.musevfx.com

Return to Fusion

Who is online

Users browsing this forum: No registered users and 3 guests