Skip to content

Instantly share code, notes, and snippets.

@chunkydotdev
Created March 9, 2022 15:13
Show Gist options
  • Save chunkydotdev/5a41ab927ca2749848fe0cee58aa1e67 to your computer and use it in GitHub Desktop.
Save chunkydotdev/5a41ab927ca2749848fe0cee58aa1e67 to your computer and use it in GitHub Desktop.
Fishbubble using the attrs method
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