Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/src/animation/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useSmoothedValue } from './useSmoothedValue';
19 changes: 19 additions & 0 deletions packages/core/src/animation/useSmoothedValue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { useTransition, TransitionPresets } from '@vueuse/core';
import type { MaybeRefOrGetter } from 'vue';

/**
* Returns a smoothed version of a numeric value using easeOutExpo easing.
* Works for any continuously-updating number: gauge needles, digital readouts, etc.
*
* @param source Reactive numeric source (ref, computed, or getter)
* @param duration Transition duration in ms; 0 = instant (no easing)
*/
export function useSmoothedValue(
source: MaybeRefOrGetter<number>,
duration: MaybeRefOrGetter<number>,
) {
return useTransition(source, {
duration,
transition: TransitionPresets.easeOutExpo,
});
}
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import './math';

export { PrerenderedSvgImage } from './components';
export * from './animation';
export * from './flightgear-properties';
export * from './flightgear-http';
export { clamp, installPanelMath, interpolate, panelMathMixin } from './math';