Animation.SyncLayer Manual     Reference     Scripting  
Scripting > Runtime Classes > Animation

function SyncLayer (layer : int) : void


Synchronizes playback speed of all animations in the layer.

When blending between two looping animations they often have different lengths. For example a walk cycle often takes longer than a run cycle. When blending between them you need to make sure that the foot placement of the walk and run cycle happens at the same time. In other word playback speed of the animations must be adjusted so that the animations are synchronized. SyncLayer will calculate the average normalized playback speed of all animations in the layer based on their blend weight. Then it will apply that playback speed to all animations in the layer.

// Puts the walk and run animation in the same
// layer and synchronizes their speed
animation["walk"].layer = 1;
animation["run"].layer = 1;