applyGrowEffect function exported
Last updated: 2026-03-05T10:53:28.861Z
Metrics
LOC: 35
Complexity: 5
Params: 3
Signature
applyGrowEffect(
target: Element | null,
config: GrowEffect,
): : Promise<void>
Summary
Applies the grow effect on target and resolves after it finishes.
Source Code
export function applyGrowEffect(
target: Element | null,
config: GrowEffect,
): Promise<void> {
return new Promise((resolve) => {
if (!target || !(target instanceof HTMLElement)) {
resolve();
return;
}
const scale = config.scale ?? 1.15;
const duration = config.duration ?? 400;
const prevTransition = target.style.transition;
const prevTransform = target.style.transform;
const prevZIndex = target.style.zIndex;
target.style.transition = `transform ${duration / 2}ms ease`;
target.style.zIndex = "9999";
target.style.transform = `${prevTransform} scale(${scale})`;
setTimeout(() => {
target.style.transform = prevTransform;
setTimeout(
() => {
target.style.transition = prevTransition;
target.style.zIndex = prevZIndex;
resolve();
},
duration / 2 + 20,
);
}, duration / 2);
});
}
Dependencies (Outgoing)
| Target | Type |
|---|---|
| GrowEffect | uses |
Impact (Incoming)
| Source | Type |
|---|---|
| resolveTarget | uses |
| applyEffect | calls |