model-viewer icon indicating copy to clipboard operation
model-viewer copied to clipboard

feat: make options for appendAnimation and detachAnimation optional

Open Frank3K opened this issue 8 months ago • 0 comments

Description

This PR makes all parameters of AppendAnimationOptions and DetachAnimationOptions optional.

Such that the following is possible:

// Example: Only specify repetitions
appendAnimation('some-animation', { repetitions: 5 });

// Example: Only specify fade for detach
detachAnimation('some-animation', { fade: 200 });

Previously, you had to pass all options, or no options at all (in case the default was used). Current code in master:

https://github.com/google/model-viewer/blob/4efaf8eebb8a9b48080b87faa39faa544a728f92/packages/model-viewer/src/features/animation.ts#L33-L41

@mohammadbaghaei Would you be so kind to do the review? I tried to use appendAnimation, but then I was a bit surprised I needed to pass all parameters. I have no real experience with these methods, so it would be nice if you can take a look and functionally test.

Reference Issue

Frank3K avatar Apr 15 '25 19:04 Frank3K