Skip to content

Commit

Permalink
Fix timeStep logic in CreateMaterialColorAnimation (#29111)
Browse files Browse the repository at this point in the history
* Fix timeStep logic in CreateMaterialColorAnimation

* Fix edge-case with only one color
  • Loading branch information
JiDW authored Aug 13, 2024
1 parent 97b3164 commit f7c92c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/jsm/animation/AnimationClipCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class AnimationClipCreator {
static CreateMaterialColorAnimation( duration, colors ) {

const times = [], values = [],
timeStep = duration / colors.length;
timeStep = ( colors.length > 1 ) ? duration / ( colors.length - 1 ) : 0;

for ( let i = 0; i < colors.length; i ++ ) {

Expand Down

0 comments on commit f7c92c8

Please sign in to comment.