Created
March 9, 2022 15:13
-
-
Save chunkydotdev/5a41ab927ca2749848fe0cee58aa1e67 to your computer and use it in GitHub Desktop.
Fishbubble using the attrs method
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
import styled from 'styled-components' | |
const FishBubble = styled.div.attrs(({ y, x }: { y: number; x: number }) => ({ | |
style: { | |
top: `${y}%`, | |
left: `${x}px` | |
} | |
}))` | |
position: absolute; | |
height: 4px; | |
width: 4px; | |
background-color: white; | |
animation: up 1.5s linear forwards; | |
@keyframes up { | |
0% { | |
transform: translateY(0); | |
opacity: 1; | |
} | |
100% { | |
transform: translateY(-200px); | |
opacity: 0; | |
} | |
} | |
` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment