My Animated Background
Content goes here
--- name: lightweight-3d-effects description: Lightweight 3D effects for decorative elements and micro-interactions using Zdog, Vanta.js, and Vanilla-Tilt.js. Use this skill when adding pseudo-3D illustrations, animated backgrounds, parallax tilt effects, decorative 3D elements, or subtle depth effects without heavy frameworks. Triggers on tasks involving Zdog pseudo-3D, Vanta.js backgrounds, Vanilla-Tilt parallax, card tilt effects, hero section animations, or lightweight landing page visuals. Ideal for performance-focused designs. --- # Lightweight 3D Effects Skill ## Overview This skill combines three powerful libraries for decorative 3D elements and micro-interactions: - **Zdog**: Pseudo-3D engine for designer-friendly vector illustrations - **Vanta.js**: Animated 3D backgrounds powered by Three.js/p5.js - **Vanilla-Tilt.js**: Smooth parallax tilt effects responding to mouse/gyroscope ## When to Use This Skill - Add decorative 3D illustrations without heavy frameworks - Create animated backgrounds for hero sections - Implement subtle parallax tilt effects on cards/images - Build lightweight landing pages with visual depth - Add micro-interactions that enhance UX without performance impact ## Zdog - Pseudo-3D Illustrations ### Core Concepts Zdog is a pseudo-3D engine that renders flat, round designs in 3D space using Canvas or SVG. **Key Features:** - Designer-friendly declarative API - Small file size (~28kb minified) - Canvas or SVG rendering - Drag rotation built-in - Smooth animations ### Basic Setup ```html
``` ### Zdog Shapes **Basic Shapes:** ```javascript // Circle new Zdog.Ellipse({ addTo: illo, diameter: 80, stroke: 20, color: '#636', }); // Rectangle new Zdog.Rect({ addTo: illo, width: 80, height: 60, stroke: 10, color: '#E62', fill: true, }); // Rounded Rectangle new Zdog.RoundedRect({ addTo: illo, width: 60, height: 40, cornerRadius: 10, stroke: 4, color: '#C25', fill: true, }); // Polygon new Zdog.Polygon({ addTo: illo, radius: 40, sides: 5, stroke: 8, color: '#EA0', fill: true, }); // Line new Zdog.Shape({ addTo: illo, path: [ { x: -40, y: 0 }, { x: 40, y: 0 }, ], stroke: 6, color: '#636', }); // Bezier Curve new Zdog.Shape({ addTo: illo, path: [ { x: -40, y: -20 }, { bezier: [ { x: -40, y: 20 }, { x: 40, y: 20 }, { x: 40, y: -20 }, ], }, ], stroke: 4, color: '#C25', closed: false, }); ``` ### Zdog Groups Organize shapes into groups for complex models: ```javascript // Create a group let head = new Zdog.Group({ addTo: illo, translate: { y: -40 }, }); // Add shapes to group new Zdog.Ellipse({ addTo: head, diameter: 60, stroke: 30, color: '#FED', }); // Eyes new Zdog.Ellipse({ addTo: head, diameter: 8, stroke: 4, color: '#333', translate: { x: -10, z: 15 }, }); new Zdog.Ellipse({ addTo: head, diameter: 8, stroke: 4, color: '#333', translate: { x: 10, z: 15 }, }); // Mouth new Zdog.Shape({ addTo: head, path: [ { x: -10, y: 0 }, { bezier: [ { x: -5, y: 5 }, { x: 5, y: 5 }, { x: 10, y: 0 }, ], }, ], stroke: 2, color: '#333', translate: { y: 5, z: 15 }, closed: false, }); // Rotate entire group head.rotate.y = Math.PI / 4; ``` ### Zdog Animation ```javascript // Continuous rotation function animate() { illo.rotate.y += 0.03; illo.updateRenderGraph(); requestAnimationFrame(animate); } animate(); // Bounce animation let t = 0; function bounceAnimate() { t += 0.05; illo.translate.y = Math.sin(t) * 20; illo.updateRenderGraph(); requestAnimationFrame(bounceAnimate); } bounceAnimate(); // Interactive rotation with easing let targetRotateY = 0; let currentRotateY = 0; document.addEventListener('mousemove', (event) => { targetRotateY = (event.clientX / window.innerWidth - 0.5) * Math.PI; }); function smoothAnimate() { // Ease towards target currentRotateY += (targetRotateY - currentRotateY) * 0.1; illo.rotate.y = currentRotateY; illo.updateRenderGraph(); requestAnimationFrame(smoothAnimate); } smoothAnimate(); ``` --- ## Vanta.js - Animated 3D Backgrounds ### Core Concepts Vanta.js provides animated WebGL backgrounds with minimal setup, powered by Three.js or p5.js. **Key Features:** - 14+ animated effects (Waves, Birds, Net, Clouds, etc.) - Mouse/touch interaction - Customizable colors and settings - ~120KB total (including Three.js) - 60fps on most devices ### Basic Setup ```htmlContent goes here
With glare effect
Animated background with content overlay
Lightning quick performance
Stunning visual design
Feature-rich platform