Skip to content

Commit

Permalink
Added some comment for the hook
Browse files Browse the repository at this point in the history
  • Loading branch information
dvmoritzschoefl committed Nov 6, 2024
1 parent 9532844 commit 7975baa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/vis/vishooks/hooks/useAnimatedTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ function linearInterpolate(startMatrix: ZoomTransform, endMatrix: ZoomTransform,
});
}

/**
* Hook that returns an animate function that can be used to animate between two zoom transforms (keyframes).
* After calling animate, the onIntermediate callback will be called with the monitors refresh rate (requestAnimationFrame)
* with the intermediate transform values (cosine interpolated).
*/
export function useAnimatedTransform({ onIntermediate }: { onIntermediate: (intermediateTransform: ZoomTransform) => void }) {
const stateRef = React.useRef({
start: undefined as ZoomTransform | undefined,
Expand Down

0 comments on commit 7975baa

Please sign in to comment.