Code: Select all
local interpNew = MOHO.InterpSetting:new_local()
interpNew.interpMode = MOHO.INTERP_BEZIER
-- component = 0|1|2, corresponding to the x|y|z subchannels of the given channel
interpNew:SetBezierOutAngle(component, outA)
interpNew:SetBezierOutPercentage(component, outP)
interpNew:SetBezierInAngle(component, inA)
interpNew:SetBezierInPercentage(component, inP)
chan:SetKeyInterp(frameNum, interpNew)
Through experimentation, I've learned that:
- The Bezier easing parameters applied to a keyframe affect the tween between that keyframe and the following one, where "Out" refers to the control point on the first keyframe and "In" refers to the control point on the second keyframe (opposite of the "in"/"out" terminology used in Moho's UI)
- The SetBezierOutPercentage() and SetBezierInPercentage() methods govern where each keyframe's Bezier handle lies as a percentage (from 0 to 1) of the distance from that keyframe to the other
- The SetBezierOutAngle() and SetBezierInAngle() methods use radians, ranging from 0 indicating a handle that extends horizontally from the keyframe, to ±1.57 (±π/2), with positive being up from the first (out) keyframe or down from the second (in) keyframe.
- The SetBezierOutAngle() and SetBezierInAngle() angles relate to both the change in time (number of frames between keyframe 2 and keyframe 1) and change in distance (difference in subchannel value between keyframes 2 and 1).
Hope this question makes sense to someone!
Thanks,
Dave