discoverthreejs-site icon indicating copy to clipboard operation
discoverthreejs-site copied to clipboard

VectorKeyframeTrack references ".material.opacity" instead of ".position"

Open michaelnicol opened this issue 3 years ago • 1 comments

In the following code in the animation section of the book: Link to code block description

The following code is provided:

These three keyframes will make an object start at the center of the scene, move right, up, and forwards over three seconds, then reverse direction and move back to the center. Next, we’ll create a vector track with these keyframes.

import { VectorKeyframeTrack } from 'three';

const times = [0, 3, 6];
const values = [0, 0, 0, 2, 2, 2, 0, 0, 0 ];

const positionKF = new VectorKeyframeTrack('.material.opacity', times, values);

Since this is a Vector track, the key track property should be .position, not .material.opacity

michaelnicol avatar Jun 10 '22 16:06 michaelnicol

Good catch, I will update this.

looeee avatar Aug 15 '22 02:08 looeee