2021-06-28 22:22:23 +00:00
|
|
|
import React from 'react'
|
2021-06-07 21:12:14 +00:00
|
|
|
import styled from 'styles'
|
2021-06-30 20:31:29 +00:00
|
|
|
import { motion } from 'framer-motion'
|
|
|
|
|
2021-06-28 22:22:23 +00:00
|
|
|
export default function Cursor({
|
|
|
|
color = 'dodgerblue',
|
2021-06-30 20:31:29 +00:00
|
|
|
duration = 0,
|
|
|
|
bufferedXs = [],
|
|
|
|
bufferedYs = [],
|
|
|
|
times = [],
|
2021-06-28 22:22:23 +00:00
|
|
|
}: {
|
2021-06-30 20:31:29 +00:00
|
|
|
color: string
|
|
|
|
duration: number
|
|
|
|
bufferedXs: number[]
|
|
|
|
bufferedYs: number[]
|
|
|
|
times: number[]
|
2021-06-28 22:22:23 +00:00
|
|
|
}): JSX.Element {
|
2021-06-07 21:12:14 +00:00
|
|
|
return (
|
|
|
|
<StyledCursor
|
2021-06-28 22:22:23 +00:00
|
|
|
color={color}
|
2021-06-30 20:31:29 +00:00
|
|
|
initial={false}
|
|
|
|
animate={{
|
|
|
|
x: bufferedXs,
|
|
|
|
y: bufferedYs,
|
|
|
|
transition: {
|
|
|
|
type: 'tween',
|
|
|
|
ease: 'linear',
|
|
|
|
duration,
|
|
|
|
times,
|
|
|
|
},
|
|
|
|
}}
|
2021-06-07 21:12:14 +00:00
|
|
|
width="35px"
|
|
|
|
height="35px"
|
|
|
|
viewBox="0 0 35 35"
|
|
|
|
version="1.1"
|
|
|
|
pointerEvents="none"
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
|
|
>
|
|
|
|
<path
|
|
|
|
d="M12,24.4219 L12,8.4069 L23.591,20.0259 L16.81,20.0259 L16.399,20.1499 L12,24.4219 Z"
|
2021-06-28 22:22:23 +00:00
|
|
|
fill="#ffffff"
|
2021-06-07 21:12:14 +00:00
|
|
|
/>
|
|
|
|
<path
|
|
|
|
d="M21.0845,25.0962 L17.4795,26.6312 L12.7975,15.5422 L16.4835,13.9892 L21.0845,25.0962 Z"
|
2021-06-28 22:22:23 +00:00
|
|
|
fill="#ffffff"
|
2021-06-07 21:12:14 +00:00
|
|
|
/>
|
|
|
|
<path
|
|
|
|
d="M19.751,24.4155 L17.907,25.1895 L14.807,17.8155 L16.648,17.0405 L19.751,24.4155 Z"
|
2021-06-28 22:22:23 +00:00
|
|
|
fill="currentColor"
|
2021-06-07 21:12:14 +00:00
|
|
|
/>
|
|
|
|
<path
|
|
|
|
d="M13,10.814 L13,22.002 L15.969,19.136 L16.397,18.997 L21.165,18.997 L13,10.814 Z"
|
2021-06-28 22:22:23 +00:00
|
|
|
fill="currentColor"
|
2021-06-07 21:12:14 +00:00
|
|
|
/>
|
|
|
|
</StyledCursor>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-06-30 20:31:29 +00:00
|
|
|
const StyledCursor = styled(motion.g, {
|
2021-06-07 21:12:14 +00:00
|
|
|
position: 'absolute',
|
|
|
|
zIndex: 1000,
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
})
|