@@ -7,6 +7,7 @@ type AnimationRangesProps = ViewRangeOptionsSchema;
7
7
8
8
const insetSize = "60px" ;
9
9
const borderColor = "#ccc" ;
10
+ const progressVariable = "--ws-progress" ;
10
11
11
12
const Wrapper = styled ( Box , {
12
13
position : "relative" ,
@@ -32,8 +33,8 @@ const Scrollable = styled(Box, {
32
33
} ) ;
33
34
34
35
const bgKeyframes = keyframes ( {
35
- "0%" : { "--progress" : "0" } ,
36
- "100%" : { "--progress" : "360" } ,
36
+ "0%" : { [ progressVariable ] : "0" } ,
37
+ "100%" : { [ progressVariable ] : "360" } ,
37
38
} ) ;
38
39
39
40
const rafInterval = ( callback : ( ) => void ) : ( ( ) => void ) => {
@@ -58,7 +59,7 @@ export const AnimationRanges = (props: AnimationRangesProps) => {
58
59
useEffect ( ( ) => {
59
60
try {
60
61
CSS . registerProperty ( {
61
- name : "--progress" ,
62
+ name : progressVariable ,
62
63
syntax : "<number>" ,
63
64
inherits : true ,
64
65
initialValue : "0" ,
@@ -120,6 +121,9 @@ export const AnimationRanges = (props: AnimationRangesProps) => {
120
121
] ;
121
122
122
123
const progressRadius = "6px" ;
124
+ const progressWidth = "4px" ;
125
+ const progressInactiveColor = "oklch(92.9% 0.013 255.508)" ;
126
+ const progressActiveColor = "oklch(54.6% 0.245 262.881)" ;
123
127
124
128
return (
125
129
< Wrapper >
@@ -153,11 +157,10 @@ export const AnimationRanges = (props: AnimationRangesProps) => {
153
157
inset : 0 ,
154
158
borderRadius : progressRadius ,
155
159
156
- background : `conic-gradient(oklch(54.6% 0.245 262.881) calc(var(--progress , 0) * 1deg), oklch(92.9% 0.013 255.508) 0)` ,
160
+ background : `conic-gradient(${ progressActiveColor } calc(var(${ progressVariable } , 0) * 1deg), ${ progressInactiveColor } 0)` ,
157
161
mask : `linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)` ,
158
-
159
162
maskComposite : `exclude` ,
160
- padding : `4px` ,
163
+ padding : progressWidth ,
161
164
} }
162
165
/>
163
166
0 commit comments