Last active
December 23, 2023 20:35
-
-
Save betafcc/a9e0fe1b02228e0153ccd3e1cf0fd571 to your computer and use it in GitHub Desktop.
Revisions
-
betafcc revised this gist
Dec 23, 2023 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,18 +9,20 @@ export const Ticks: FC< count: number length: number width: number align: 'in' | 'out' | 'center' } > = ({ r, count, length, width, align, ...props }) => { const C = 2 * Math.PI * r return ( <circle {...props} r={align === 'in' ? r - length / 2 : align === 'out' ? r + length / 2 : r} strokeWidth={length} pathLength={C} strokeDasharray={`${width} ${C / count - width}`} strokeDashoffset={`${width / 2}`} /> ) } -
betafcc created this gist
Dec 23, 2023 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ import { ComponentProps, FC } from 'react' export const Ticks: FC< Omit< ComponentProps<'circle'>, 'strokeWidth' | 'pathLength' | 'strokeDasharray' | 'strokeDashoffset' | 'r' > & { r: number count: number length: number width: number } > = ({ r, count, length, width, ...props }) => { const C = 2 * Math.PI * r return ( <circle {...props} r={r} strokeWidth={length} pathLength={C} strokeDasharray={`${width} ${C / count - width}`} strokeDashoffset={`${width / 2}`} /> ) }