htmlbeginnermit
Rotating Badge
A circular badge that spins around itself.
3.2k3.3k1.0k414
About this module
A circular stamp badge with text along the arc that continuously rotates using a GSAP yoyo tween.
#gsap#badge#rotate#circular
Source code
Installation
- 1
Install GSAP
Install the animation library with your package manager.
npm install gsap - 2
Create the files
Create `index.html`, `style.css` and `script.js` in the same folder.
- 3
Paste the code
Copy each file's source into its matching file.
- 4
Run it
Open `index.html` (or import the logic into your bundler setup).
Usage
- 1
Copy the HTML
Paste the markup where you need it.
<link rel="stylesheet" href="style.css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"></script> <script src="script.js"></script> <div class="mh-badge"> <svg viewBox="0 0 100 100"> <defs><path id="mh-circle" d="M50,50 m-38,0 a38,38 0 1,1 76,0 a38,38 0 1,1 -76,0"/></defs> <text><textPath href="#mh-circle">MODULEHARBOR · PREVIEW · COPY · BUILD · </textPath></text> </svg> <span class="mh-center">✦</span> </div> - 2
Paste the script
Include `script.js` after GSAP.
gsap.to(".mh-badge svg", { rotate: 360, duration: 12, ease: "none", repeat: -1, });