- Interaction
- Hover loop
- Category
- Social media
- Duration
- 1.67 s
- Frame rate
- 30 fps
- Artboard
- 32 × 32 px
- Lottie size
- 4.4 kB
Codepen
Animated codepen icon
Codepen is a 1.67 s micro animation from the social media set that loops while hovered, like Github and Dribbble. Hover loop icons typically mark social links, community invites, portfolio links and language pickers.
Free under the MIT license · Markdown version · About the files
Use it
npm install react-useanimationsimport UseAnimations from 'react-useanimations';
import codepen from 'react-useanimations/lib/codepen';
<UseAnimations animation={codepen} size={32} />npx shadcn@latest add https://useanimations.com/r/codepen.jsonimport { AnimatedCodepen } from '@/components/animations/codepen';
<AnimatedCodepen size={24} /><div id="codepen-icon" style="width: 48px; height: 48px"></div>
<script src="https://cdn.jsdelivr.net/npm/lottie-web@5.13.0/build/player/lottie_light.min.js"></script>
<script>
const el = document.getElementById('codepen-icon');
const a = lottie.loadAnimation({ container: el, renderer: 'svg', loop: true, autoplay: false, path: 'https://useanimations.com/icons/codepen.json' });
const motion = matchMedia('(prefers-reduced-motion: reduce)');
let stopAfterCycle = false;
a.addEventListener('loopComplete', () => { if (stopAfterCycle) { stopAfterCycle = false; a.goToAndStop(0, true); } });
el.addEventListener('mouseenter', () => { stopAfterCycle = false; if (!motion.matches) a.play(); });
el.addEventListener('mouseleave', () => { stopAfterCycle = !motion.matches && !a.isPaused; if (!stopAfterCycle) a.goToAndStop(0, true); });
</script>Codepen runs on the light build, lottie_light.min.js.
import LottieView from 'lottie-react-native';
<LottieView source={{ uri: 'https://useanimations.com/icons/codepen.json' }} autoPlay loop={false} style={{ width: 48, height: 48 }} />import Lottie
LottieView {
await LottieAnimation.loadedFrom(url: URL(string: "https://useanimations.com/icons/codepen.json")!)
}
.playing(loopMode: .playOnce)
.frame(width: 48, height: 48)val composition by rememberLottieComposition(LottieCompositionSpec.Url("https://useanimations.com/icons/codepen.json"))
LottieAnimation(composition, iterations = 1, modifier = Modifier.size(48.dp))import 'package:lottie/lottie.dart';
Lottie.network('https://useanimations.com/icons/codepen.json', width: 48, height: 48, repeat: false)Bundle codepen.json with the app to use it offline.
<img src="https://useanimations.com/icons/codepen/codepen.svg" alt="Codepen" width="24" height="24" />Inside <img> the SVG draws black; inline it to follow the text color.
Static SVG
Questions about the Codepen icon
›Where does Codepen stop after hover?
It finishes the cycle it is in (at most 1.67 s) and then rests on its first frame, so it never freezes mid-motion. Keyboard focus plays it as well; a tap on a touch screen does not.
›Is Codepen decorative?
By default it is aria-hidden. Pass aria-label="Codepen" to announce it as an image, or leave it hidden when the link or button it sits in has its own text.
›Can Codepen loop all the time instead?
Yes: pass interaction="loop". It then plays continuously; stays on the static first frame when reduced motion is preferred.