ScaleAndOffset
 
 
 

ScaleAndOffset

Description

Offsets or scales the animation of the specified objects by offsetting (stretching) or scaling (shrinking) the portion of an fcurve between a start and end frame using a specified pivot point, then translating the resulting scaled fcurve portion. You can use this command to change the timing of all animation in a scene at once.

By default, the ripple effect is active, meaning that the region offsets other keys that are further along on the timeline (to the right). The rest of the function curve is moved to the right of the inserted region, causing a ripple effect. You can turn this feature off by setting the Ripple argument to False.

ScaleAndOffset is the command equivalent of moving or scaling a keyframe region in the dopesheet. It should be used when trying to emulate dopesheet behaviour. The Sequence command is similar in effect but is the command equivalent of doing Animation > Sequence Animation. When emulating Animation > Sequence Animation behaviour, use Sequence instead.

Scripting Syntax

ScaleAndOffset( [InputObjs], [Type], [Offset], [Scale], [StartFrame], [EndFrame], [Pivot], [Ripple], Mode, [Discrete Time], [SelectedKeysOnly], [Layer] );

Parameters

Parameter Type Description
InputObjs String List of animatable parameters (for example "cone*/kine.local.pos"). This parameter uses the Type parameter to interpret which parameters to use in this way:

- If Type == siInputParameters then InputObjs is used exactly as input (either from the specified list or the animatable parameters on the selected objects).

- If Type == siAnimatedParameters then InputObjs is expected to be a list of objects on which each animatable parameter will be affected.

- If Type == siAllAnimatedParameters then the value of InputObjs is ignored and instead the command uses all animated parameters on all objects in the entire scene.

Default Value: If no value is specified for this parameter, the Object List will use the selected objects or parameters respecting the scope indicated by the Type argument.

Type siParameterScope Parameter scope of the operation.

Default Value: siAnimatedParameters

Offset Double Value of the offset you want to apply to the fcurve(s).

Value range -Inf, +Inf
Scale Double Value of the scaling factor you want to apply to the fcurve(s).

Value range 0, +Inf
StartFrame Double Start frame of the region of the fcurve(s) you want to operate.

Value range -Inf, +Inf
EndFrame Double End frame of the region of the fcurve(s) you want to operate.

Value range -Inf, +Inf
Pivot Double Pivot frame is the frame w.r.t which you wish to scale.

Value range 0, +Inf
Ripple Boolean Ripple effect of resulting fcurve.

Possible Values:

Description:

0 False
1 True
Mode siSequenceMode Affected items for SequenceAll only.

Default Value: siFCurvesAnimationSources

Discrete Time Boolean Make sure that all the keys will fall on frames.

Possible Values:

Description:

0 False
1 True
SelectedKeysOnly Boolean True to scale and offset only the selected keys within the timerange (from StartFrame to EndFrame). To create or modify a key selection, use the SelectKeysInTimespan command.

By default (false), this command operates on all keys within the timerange.

Default Value: False

Possible Values:

Description:

0 False
1 True
Layer Integer Animation layer to scale and offset

Default Value: All layers (-1)

Examples

VBScript Example

'
' Create a cube and a null with identical animation,
' then scale the cube's animation by half and offset it 50 frames.
'
dim oNull,oCube
set oCube = CreatePrim("Cube", "MeshSurface")
oCube.length = 1
set oNull = GetPrim("Null")
AddToMarking "kine.local.pos.posx,kine.local.pos.posz"
Translate oNull, -3, 0, 3, siAbsolute, siView, siObj, siXYZ
SaveKey ,1
Translate oNull, 0, 0, -3, siAbsolute, siView, siObj, siXYZ
SaveKey , 50
Translate oNull, 3, 0, 3, siAbsolute, siView, siObj, siXYZ
SaveKey , 100
'copy null's animation over to the cube
CopyAllAnimation2 oNull, siAnySource, siAllParam, False
PasteAllAnimation oCube
'
' Now Scale and offset the cube animation
' The begining of the animation is offset to frame 50
' and the entire sequence is scaled by 0.5 
'
ScaleAndOffset oCube, siAnimParams, 50, 0.5, 1, 100, 1, True, , False
'
' The cube will stay at its initial position till
' frame 50, then catch up to the null
'
PlayForwardsFromStart

See Also

FCurve Sequence ActivateFCurve SelectKeysInTimespan