Skip to content

Commit 3baadca

Browse files
committed
feat(tooltip): enhance toggle animation with customizable duration and easing functions
1 parent 14f798a commit 3baadca

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/tooltip/tooltip.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { LitElement, html, nothing } from 'lit';
22
import { property, query } from 'lit/decorators.js';
33
import { type Ref, createRef, ref } from 'lit/directives/ref.js';
4+
import { EaseOut } from '../../animations/easings.js';
45
import { addAnimationController } from '../../animations/player.js';
56
import { fadeOut } from '../../animations/presets/fade/index.js';
67
import { scaleInCenter } from '../../animations/presets/scale/index.js';
@@ -247,8 +248,11 @@ export default class IgcTooltipComponent extends EventEmitterMixin<
247248
}
248249

249250
private async _toggleAnimation(dir: 'open' | 'close') {
250-
const animation = dir === 'open' ? scaleInCenter : fadeOut;
251-
return this._animationPlayer.playExclusive(animation());
251+
const animation =
252+
dir === 'open'
253+
? scaleInCenter({ duration: 150, easing: EaseOut.Quad })
254+
: fadeOut({ duration: 75, easing: EaseOut.Sine });
255+
return this._animationPlayer.playExclusive(animation);
252256
}
253257

254258
private async _forceAnimationStop() {

0 commit comments

Comments
 (0)