Skip to content

Commit

Permalink
accept color byValue
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Oct 22, 2022
1 parent 139ee11 commit d1c1037
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/util/animation/ColorAnimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class ColorAnimation extends AnimationBase<TColorAlphaSource> {
constructor({
startValue,
endValue,
byValue,
easing = (currentTime, startValue, byValue, duration) => {
const durationRate =
1 - Math.cos((currentTime / duration) * (Math.PI / 2));
Expand All @@ -29,9 +30,11 @@ export class ColorAnimation extends AnimationBase<TColorAlphaSource> {
...options,
startValue: startColor,
endValue: endColor,
byValue: endColor.map(
(value, i) => value - startColor[i]
) as TColorAlphaSource,
byValue: byValue
? new Color(byValue).getSource()
: (endColor.map(
(value, i) => value - startColor[i]
) as TColorAlphaSource),
easing,
onChange: wrapColorCallback(onChange),
onComplete: wrapColorCallback(onComplete),
Expand Down

0 comments on commit d1c1037

Please sign in to comment.