π Color Cyclone Background
Transform your UI with ColorCyclone, a mesmerizing React animation component that creates a swirling vortex of dynamic colors! π¨β¨ Using Framer Motion, this effect blends multiple radial gradients, smoothly shifting them across the screen to form a hypnotic cyclone of motion and depth. Perfect for hero sections, interactive backgrounds, loading screens, and futuristic UI designs, ColorCyclone adds a fluid, dreamlike ambiance that keeps users engaged. Whether youβre crafting a modern web experience, a sci-fi-inspired design, or an eye-catching visual effect, this component brings the magic of animated color transitions to your projects. π
Preview
Color Cyclone Background
Follow below steps ππ»
Install dependencies
1npm i framer-motion
Component
Create a file color-cyclone.tsx in your components folder and paste this code
1import React from 'react';2import { motion } from 'framer-motion';34const ColorCyclone = ({ children }: { children?: React.ReactNode }) => {5const fogs = [6{7fromX: '0%',8fromY: '0%',9gotoX: '-40%',10gotoY: '-40%',11background: 'radial-gradient(circle, rgba(255,182,193,1), transparent 45%)'12},13{14fromX: '0%',15fromY: '0%',16gotoX: '40%',17gotoY: '40%',18background: 'radial-gradient(circle, rgba(173,216,230,1), transparent 45%)'19},20{21fromX: '0%',22fromY: '0%',23gotoX: '-40%',24gotoY: '40%',25background: 'radial-gradient(circle, rgba(144,238,144,1), transparent 45%)'26},27{28fromX: '0%',29fromY: '0%',30gotoX: '40%',31gotoY: '-40%',32background: 'radial-gradient(circle, rgba(255,228,181,1), transparent 45%)'33},34{35fromX: '0%',36fromY: '0%',37gotoX: '0%',38gotoY: '40%',39background: 'radial-gradient(circle, rgba(221,160,221,1), transparent 45%)'40},41{42fromX: '0%',43fromY: '0%',44gotoX: '0%',45gotoY: '-40%',46background: 'radial-gradient(circle, rgba(240,230,140,1), transparent 45%)'47},48{49fromX: '0%',50fromY: '0%',51gotoX: '40%',52gotoY: '0%',53background: 'radial-gradient(circle, rgba(255,218,185,1), transparent 45%)'54},55{56fromX: '0%',57fromY: '0%',58gotoX: '-40%',59gotoY: '0%',60background: 'radial-gradient(circle, rgba(175,238,238,1), transparent 45%)'61}62];6364return (65<div66className="h-full w-full relative flex items-center justify-center overflow-hidden bg-[#ffffff11]"67style={{ perspective: '1000px', transformStyle: 'preserve-3d' }}68>69<div className="z-10">{children}</div>7071<motion.div72initial={{73rotateZ: 074}}75animate={{76rotateZ: 36077}}78transition={{79duration: 30,80repeat: Infinity,81repeatType: 'loop'82}}83className="h-full w-full absolute "84>85{fogs.map((fog, index) => (86<motion.div87key={index}88initial={{89transform: `translateZ(-10px) translateX(${fog.fromX}) translateY(${fog.fromY})`90}}91animate={{92transform: `translateZ(-10px) translateX(${fog.gotoX}) translateY(${fog.gotoY})`,93transition: {94duration: 3,95repeat: Infinity,96repeatType: 'reverse'97}98}}99transition={{ duration: 2, ease: 'easeInOut' }}100style={{101transformStyle: 'preserve-3d',102position: 'absolute',103top: 0,104left: 0,105width: '100%',106height: '100%',107background: fog.background108}}109/>110))}111</motion.div>112</div>113);114};115116export default ColorCyclone;
Usage
1<ColorCyclone>2<p className="text-3xl font-bold text-black">Color Cyclone</p>3</ColorCyclone>
βοΈ Got a question or feedback?
Feel free to reach out!