Capítulo 292 de 859

Chapter 292: KeyframeTrack

Core Idea

Represents a timed sequence of keyframes, which are composed of lists of times and related values, and which are used to animate a specific property of an object.

Key Concepts

  • DefaultInterpolation : InterpolateLinear | InterpolateDiscrete | InterpolateSmooth | InterpolateBezier: The default interpolation type of this keyframe track.
  • TimeBufferType : TypedArray | Array: The time buffer type of this keyframe track.
  • ValueBufferType : TypedArray | Array: The value buffer type of this keyframe track.
  • ValueTypeName : string: The value type name.
  • name : string: The track's name can refer to morph targets or bones or possibly other values within an animated object. See PropertyBinding#parseTrackName…
  • times : Float32Array: The keyframe times.
  • values : Float32Array: The keyframe values.

Reference Tables

Constructor

Signature
`new KeyframeTrack( name : string, times : Array.<number>, values : Array.<(number

Properties

PropertyDescription
`.DefaultInterpolation : InterpolateLinearInterpolateDiscrete
`.TimeBufferType : TypedArrayArray`
`.ValueBufferType : TypedArrayArray`
.ValueTypeName : stringThe value type name.
.name : stringThe track's name can refer to morph targets or bones or possibly other values within an animated object. See PropertyBinding#parseTrackName for the forms of strings that can be parsed for property bi…
.times : Float32ArrayThe keyframe times.
.values : Float32ArrayThe keyframe values.

Methods

MethodDescription
.InterpolantFactoryMethodBezier( result : TypedArray ) : BezierInterpolantFactory method for creating a new Bezier interpolant.
.InterpolantFactoryMethodDiscrete( result : TypedArray ) : DiscreteInterpolantFactory method for creating a new discrete interpolant.
.InterpolantFactoryMethodLinear( result : TypedArray ) : LinearInterpolantFactory method for creating a new linear interpolant.
.InterpolantFactoryMethodSmooth( result : TypedArray ) : CubicInterpolantFactory method for creating a new smooth interpolant.
.clone() : KeyframeTrackReturns a new keyframe track with copied values from this instance.
`.getInterpolation() : InterpolateLinearInterpolateDiscrete
.getValueSize() : numberReturns the value size.
.optimize() : KeyframeTrackOptimizes this keyframe track by removing equivalent sequential keys (which are common in morph target sequences).
.scale( timeScale : number ) : KeyframeTrackScale all keyframe times by a factor (useful for frame - seconds conversions).
`.setInterpolation( interpolation : InterpolateLinearInterpolateDiscrete
.shift( timeOffset : number ) : KeyframeTrackMoves all keyframes either forward or backward in time.
.trim( startTime : number, endTime : number ) : KeyframeTrackRemoves keyframes before and after animation without changing any values within the defined time range.
.validate() : booleanPerforms minimal validation on the keyframe track. Returns true if the values are valid.

Key Takeaways

  1. Most relevant properties: DefaultInterpolation, TimeBufferType, ValueBufferType, ValueTypeName.
  2. Key methods: InterpolantFactoryMethodBezier, InterpolantFactoryMethodDiscrete, InterpolantFactoryMethodLinear, InterpolantFactoryMethodSmooth.

Connects To