-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
120 additions
and
11 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { | ||
motion, | ||
useAnimation, | ||
useAnimationFrame, | ||
useMotionValue, | ||
useTransform, | ||
} from 'framer-motion'; | ||
import Image from 'next/image'; | ||
import { useEffect } from 'react'; | ||
import Planet1 from '../../images/illustrations/planet1.png'; | ||
import Planet2 from '../../images/illustrations/planet2.png'; | ||
|
||
export function PlanetSpinner() { | ||
// Planet 1 animation: | ||
// This rotates around the center of the div | ||
const controls = useAnimation(); | ||
useEffect(() => { | ||
controls.start({ | ||
rotate: 360, | ||
transition: { | ||
repeat: Infinity, | ||
duration: 70, | ||
ease: 'linear', | ||
}, | ||
}); | ||
}, [controls]); | ||
|
||
// Planet 2 animation: | ||
// These transform functions calculate the x and y position based on the angle | ||
const angle = useMotionValue(0); | ||
const x = useTransform(angle, (value) => 70 * Math.cos(value)); | ||
const y = useTransform(angle, (value) => 70 * Math.sin(value)); | ||
|
||
useAnimationFrame((t) => { | ||
angle.set(t / 5000); // Controls the speed of rotation | ||
}); | ||
|
||
return ( | ||
<div | ||
style={{ | ||
backgroundImage: 'url(/backgrounds/planet-bg.png)', | ||
backgroundSize: 'cover', | ||
backgroundPosition: 'center', | ||
backgroundRepeat: 'no-repeat', | ||
}} | ||
className="relative flex items-center justify-center rounded-full p-10" | ||
> | ||
<motion.div animate={controls}> | ||
<Image src={Planet1} width={90} height={90} alt="" /> | ||
</motion.div> | ||
<motion.div style={{ position: 'absolute', x: x, y: y }}> | ||
<Image src={Planet2} width={26} height={26} alt="" className="" /> | ||
</motion.div> | ||
</div> | ||
); | ||
} |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { DefaultIconProps } from '@hyperlane-xyz/widgets'; | ||
import { memo } from 'react'; | ||
import { Color } from '../../styles/Color'; | ||
|
||
// TODO move to widgets lib | ||
function _LogsIcon({ color, ...rest }: DefaultIconProps) { | ||
return ( | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" {...rest}> | ||
<path | ||
d="M0 10V8.57143H6.25V10H0ZM0 7.14286V5.71429H10V7.14286H0ZM0 4.28571V2.85714H10V4.28571H0ZM0 1.42857V0H10V1.42857H0Z" | ||
fill={color || Color.black} | ||
/> | ||
</svg> | ||
); | ||
} | ||
|
||
export const LogsIcon = memo(_LogsIcon); |
This file contains 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 characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.