This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use client'; | |
import React, { useId } from 'react'; | |
export function useCssVariable<GValue extends string | number>( | |
elementRef: React.RefObject<HTMLElement | null>, | |
config: TCssVariableConfig<GValue> | (() => TCssVariableConfig<GValue>), | |
deps: React.DependencyList = [] | |
) { | |
const id = useId(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reason it's -90 degrees rather than 0 is because atan2 uses the standard mathematical coordinate system where: | |
The x-axis runs horizontally (right is positive) | |
The y-axis runs vertically (up is positive) | |
Angles are measured counterclockwise from the positive x-axis | |
In this system: | |
0 degrees points to the right (positive x-axis) | |
90 degrees points up (positive y-axis) |