(p: SliderExampleProps = {})
| 19 | } |
| 20 | |
| 21 | export const SliderExampleScene = (p: SliderExampleProps = {}) => { |
| 22 | // Cursor: park top-left → ease to thumb (arrives frame 30) → drag to end (arrives frame 100) → release. |
| 23 | const cursorStyle = useCursorPath([ |
| 24 | { at: 0, x: 80, y: 60 }, |
| 25 | { at: 30, x: THUMB_START_X, y: THUMB_Y, duration: 26 }, |
| 26 | { at: 44, x: THUMB_START_X, y: THUMB_Y, press: true, duration: 0 }, |
| 27 | { at: 100, x: THUMB_END_X, y: THUMB_Y, press: true, duration: 56 }, |
| 28 | { at: 108, x: THUMB_END_X, y: THUMB_Y, duration: 0 }, |
| 29 | ]); |
| 30 | |
| 31 | // Slider: dual-channel — value eases 20 → 80 during the drag; thumb idles → hover → press → idle. |
| 32 | const sliderStyle = useSliderTransition([ |
| 33 | { at: 0, value: 20, thumbState: "idle" }, |
| 34 | { at: 30, thumbState: "hover", duration: 8 }, |
| 35 | { at: 44, thumbState: "press", duration: 6 }, |
| 36 | { at: 44, value: 20 }, |
| 37 | // Match the cursor's default inOut easing so the thumb tracks the cursor exactly. |
| 38 | { at: 100, value: 80, duration: 56, easing: "inOut" }, |
| 39 | { at: 108, thumbState: "idle", duration: 8 }, |
| 40 | ]); |
| 41 | |
| 42 | return ( |
| 43 | <div style={{ position: "relative", width: "100%", height: "100%" }}> |
| 44 | <div |
| 45 | style={{ |
| 46 | position: "absolute", |
| 47 | left: "50%", |
| 48 | top: "50%", |
| 49 | transform: "translate(-50%, -50%)", |
| 50 | }} |
| 51 | > |
| 52 | <Slider |
| 53 | style={sliderStyle} |
| 54 | width={320} |
| 55 | showValue={p.showValue ?? true} |
| 56 | /> |
| 57 | </div> |
| 58 | <Cursor style={cursorStyle} variant="pointer" /> |
| 59 | </div> |
| 60 | ); |
nothing calls this directly
no test coverage detected