WEBLEB
Home
Editor
Login
Pro
English
English
Français
Español
Português
Deutsch
Italiano
हिंदी
SVG Polygon Art: Vector Graphic Code
248
alejandrokundrah
Open In Editor
Publish Your Code
Recommended
14 June 2025
A Code by Metehan
18 March 2025
A Code by anhtuanle2004thl
25 March 2025
A Code by andrej.social.network
HTML
Copy
CSS
Copy
body { background: #ffffff; margin: 0; overflow: hidden; } figure { display: flex; align-items: center; justify-content: center; height: 100vh; width: 100vw; } svg { padding: 5vw; width: 90vw; } svg > * { fill: #1c1c1c; stroke: #1c1c1c; stroke-width: 0.85px; } @keyframes tip { 0%, 100% { opacity: 0; } 10%, 80% { opacity: 1; } }
JS
Copy
const elements = document.querySelectorAll("svg > *"); gsap.set(elements, { x: () => gsap.utils.random(-500, 500), y: () => gsap.utils.random(-500, 500), rotation: () => gsap.utils.random(-720, 720), scale: 0, opacity: 0 }); const tl = gsap.timeline({ repeat: -1, repeatDelay: 0.65, yoyo: true }); tl.to(elements, { x: 0, y: 0, scale: 1, opacity: 1, rotation: 0, ease: "power4.inOut", stagger: 0.0125, duration: 0.75 }); const svg = document.querySelector("svg"); svg.addEventListener("mouseenter", () => tl.timeScale(0.15)); svg.addEventListener("mouseleave", () => tl.timeScale(1));