ThreeJS Keyframe Tracks and Animation

A KeyframeTrack is a timed series of keyframes that are made up of lists of times and related values and are used to animate an object's unique property.

BooleanKeyframeTrack

A Track of boolean keyframe values.

Constructor

BooleanKeyframeTrack( name : String, times : Array, values : Array )

name - (required) identifier for the KeyframeTrack.

times - (required) array of keyframe times.

values - values for the keyframes at the times specified.

Properties

It inherits its properties from Keyframe Track, refer to previous lessons. The unique properties are as follows:

.DefaultInterpolation : Constant

The default interpolation type to use, InterpolateDiscrete.

.ValueBufferType : Array

A normal Array (no Float32Array in this case, unlike ValueBufferType of KeyframeTrack).

.ValueTypeName : String

String 'bool'.

Methods

The BooleanKeyframeTrack inherits methods from KeyframeTrack that you can refer in the previous lessons.

.InterpolantFactoryMethodLinear () : undefined

The value of this method here is 'undefined', as it does not make sense for discrete properties.

.InterpolantFactoryMethodSmooth () : undefined

The value of this method here is 'undefined', as it does not make sense for discrete properties.

ColorKeyframeTrack

Color changes are represented via a track of keyframe values.

This subclass's very basic implementation has nothing noteworthy yet. This is, however, the location for colour space parameterization.

Constructor

ColorKeyframeTrack( name : String, times : Array, values : Array )

name - (required) identifier for the KeyframeTrack.

times - (required) array of keyframe times.

values - values for the keyframes at the times specified, a flat array of color components between 0 and 1.

interpolation - the type of interpolation to use.

NumberKeyframeTrack

A Track of numeric keyframe values.

Constructor

NumberKeyframeTrack( name : String, times : Array, values : Array )

name - (required) identifier for the KeyframeTrack.

times - (required) array of keyframe times.

values - values for the keyframes at the times specified.

interpolation - the type of interpolation to use.

QuarterionKeyframeTrack

A Track of quaternion keyframe values.

Constructor

QuaternionKeyframeTrack( name : String, times : Array, values : Array )

name (required) identifier for the KeyframeTrack.

times (required) array of keyframe times.

values for the keyframes at the times specified, a flat array of quaternion components.

interpolation is the type of interpolation to use.

Properties and Methods

It inherits the properties and methods of KeyframTrack. The unique ones are as follows:

.DefaultInterpolation : Constant

The default interpolation type to use, InterpolateLinear.

.ValueTypeName : String

String 'quaternion'.

.InterpolantFactoryMethodLinear () : QuaternionLinearInterpolant

Returns a new QuaternionLinearInterpolant based on the values, times and valueSize of the keyframes.

StringKeyframeTrack

A Track of string keyframe values.

Constructor

StringKeyframeTrack( name : String, times : Array, values : Array )

name - (required) identifier for the KeyframeTrack.

times - (required) array of keyframe times.

values - values for the keyframes at the times specified.

interpolation - the type of interpolation to use.

Properties and Methods

It inherits the properties and methods of KeyframTrack. The unique ones are as follows:

.DefaultInterpolation : Constant

The default interpolation type to use, InterpolateDiscrete.

.ValueBufferType : Array

A normal Array (no Float32Array in this case, unlike ValueBufferType of KeyframeTrack).

.ValueTypeName : String

String 'string'.

.InterpolantFactoryMethodLinear () : undefined

The value of this method here is 'undefined', as it does not make sense for discrete properties.

.InterpolantFactoryMethodSmooth () : undefined

The value of this method here is 'undefined', as it does not make sense for discrete properties.

VectorKeyframeTrack

A Track of vector keyframe values.

Constructor

VectorKeyframeTrack( name : String, times : Array, values : Array )

name - (required) identifier for the KeyframeTrack.

times - (required) array of keyframe times.

Values - values for the keyframes at the times specified a flat array of vector components.

Interpolation - the type of interpolation to use.


Related Topics

ThreeJS Installation

You can use npm and modern build tools to install three.js, or you can get started quickly with static hosting or a CDN. Installing from npm is the best option...

4 minutes read.

ThreeJS Disposing an Object

The disposal of unwanted library entities is a crucial component of improving performance and avoiding memory leaks in your programme. When you create a three.js type instance, you set aside...

4 minutes read.

ThreeJS Managers

DefaultLoadingManager When no custom manager is specified, most loaders use a global instance of the LoadingManager. This will suffice for most purposes, but there may be times when you want separate loading...

4 minutes read.

ThreeJS Updating Things

If an item has been added to the scene with the specified code, it will immediately update its matrices. const object = new THREE.Object3D(); scene.add( object ); or, if they are the child...

4 minutes read.

ThreeJS Animation Systems

You may animate many aspects of your models with the three.js animation system, including the bones of a skinned and rigged model, morph targets, multiple material properties (colours, opacity, booleans),...

3 minutes read.

ThreeJS AnimationObjectGroup and Utils

AnimationObjectGroup A group of objects that receives a shared animation state. Usage Add items you'd normally send as 'root' to AnimationMixer's function Object() { [native code] } or clipAction method, and instead pass...

2 minutes read.

ThreeJS Cameras

ArrayCamera ArrayCamera can be used to render a scene using a preset group of cameras quickly. This is an important feature of VR scene rendering performance. An array of sub cameras is...

6 minutes read.

ThreeJS Layers

A Layers object assigns an Object3D to one or more of the 32 layers numbered 0 to 31 - the layers are internally stored as a bit mask, and all...

1 minute read.

ThreeJS Objects

Bone A bone that is part of a Skeleton. The skeleton in turn is used by the SkinnedMesh. Bones are almost identical to a blank Object3D. Code Example const root = new THREE.Bone(); const...

12 minutes read.

ThreeJS Keyframe Tracks and Animation

A KeyframeTrack is a timed series of keyframes that are made up of lists of times and related values and are used to animate an object's unique property. BooleanKeyframeTrack A Track of...

3 minutes read.

ThreeJS Lines and Texts

Drawing Lines Let's say you want to draw a line or a circle, not a wireframe Mesh. First, we need to set up the renderer, scene, and camera. Here is the...

3 minutes read.

ThreeJS Compatibiliy Check and Running Locally

Even though this is becoming less of an issue, some devices or browsers may still be incompatible with WebGL. The method below enables you to check if it is supported...

3 minutes read.

ThreeJS Keyframe Track

A KeyframeTrack is a timed series of keyframes that are made up of lists of times and related values and are used to animate an object's unique property. The "Animation System"...

4 minutes read.

ThreeJS Object3D

This is the base class for most three.js objects, and it provides a set of properties and methods for manipulating objects in 3D space. It should be noted that this can...

9 minutes read.

ThreeJS Helper 1

ArrowHelper A 3D arrow object for visualizing directions. Code Example const dir = new THREE.Vector3( 1, 2, 0 ); //normalize the direction vector (convert to vector of length 1) dir.normalize(); const origin = new THREE.Vector3( 0,...

5 minutes read.

ThreeJS Uniform

Uniforms are global GLSL variables. They are passed to shader programs. Code Example When declaring a uniform of a ShaderMaterial, it is declared by value or by object. uniforms: { time: { value: 1.0...

2 minutes read.

ThreeJS AnimationMixer

The AnimationMixer is a player that allows you to play animations on a specific object in the scene. When many items in a scene are animated individually, each object may...

2 minutes read.

ThreeJS InterleavedBuffer

The term "interleaved" refers to the packing of multiple attributes, possibly of different types (e.g., position, normal, uv, colour) into a single array buffer. Constructor InterleavedBuffer( array : TypedArray, stride : Integer...

3 minutes read.

ThreeJS Renderers

WebGLMultipleRenderTargets A special render target that enables a fragment shader to write to several textures. This approach is useful for advanced rendering techniques like post-processing or deferred rendering. Heads up: WebGLMultipleRenderTargets...

15 minutes read.

ThreeJS Property Binding and Mixer

PropertyBinding Internally, this holds a reference to real property in the scene graph. Constructor PropertyBinding( rootNode : Object3D, path, parsedPath ) -- rootNode: -- path -- parsedPath (optional) Properties The properties are as follows: .path : Number.parsedPath...

2 minutes read.