@@ -29,11 +29,12 @@ export const LFO = forwardRef<LFORef, LFOProps>((props, ref) => {
2929 } = props
3030
3131 const amplitude = validValue ( _anplitude , 0 , 1 )
32- const delay = validValue ( _delay , 0 , 100 )
32+ const delay = validValue ( _delay , 0 , 1000 )
3333
3434 const LFORef = useRef < LFORef | null > ( null )
3535 const xScale = useRef < d3 . ScaleLinear < number , number > | null > ( null )
3636 const yScale = useRef < d3 . ScaleLinear < number , number > | null > ( null )
37+ const delayInSeconds = delay / 1000
3738
3839 useImperativeHandle ( ref , ( ) => LFORef . current as LFORef )
3940
@@ -88,17 +89,17 @@ export const LFO = forwardRef<LFORef, LFOProps>((props, ref) => {
8889 if ( delay > 0 ) {
8990 svg
9091 . append ( 'circle' )
91- . attr ( 'cx' , delay )
92- . attr ( 'cy' , height / 2 )
92+ . attr ( 'cx' , delayInSeconds )
93+ . attr ( 'cy' , yScale . current ! ( 0.5 ) )
9394 . attr ( 'r' , lineWidth / 2 )
9495 . attr ( 'fill' , lineColor )
9596
9697 svg
9798 . append ( 'line' )
9899 . attr ( 'x1' , 0 )
99- . attr ( 'y1' , height / 2 )
100- . attr ( 'x2' , delay + 1 )
101- . attr ( 'y2' , height / 2 )
100+ . attr ( 'y1' , yScale . current ! ( 0.5 ) )
101+ . attr ( 'x2' , xScale . current ! ( delayInSeconds ) + 1 )
102+ . attr ( 'y2' , yScale . current ! ( 0.5 ) )
102103 . attr ( 'stroke' , lineColor )
103104 . attr ( 'stroke-width' , lineWidth )
104105 }
@@ -130,7 +131,7 @@ export const LFO = forwardRef<LFORef, LFOProps>((props, ref) => {
130131 . attr ( 'stroke' , lineColor )
131132 . attr ( 'stroke-width' , lineWidth )
132133 . attr ( 'd' , line )
133- . attr ( 'transform' , `translate(${ delay } , 0)` )
134+ . attr ( 'transform' , `translate(${ delayInSeconds * width } , 0)` )
134135 }
135136
136137 const generateSineWaveData = (
0 commit comments