Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Animation Utilities in TailwindCSS

Animation Utilities in TailwindCSS

? Animation Utilities in Tailwind CSS

Tailwind CSS includes built-in animation utilities that let you apply CSS animations quickly and easily, using predefined animation names, durations, easing, and iteration counts.


Core Animation Utilities

1. animate-{name}

Applies a predefined keyframe animation. Some common built-in animations:

ClassDescription
animate-noneDisables animation
animate-spinRotates element 360 degrees forever
animate-pingScales and fades out repeatedly (pulse effect)
animate-pulseSmooth fade in and out repeatedly
animate-bounceBounces element up and down repeatedly

2. Animation Duration, Timing, Delay, and Iteration

You can customize animations with these utilities:

Utility ClassCSS PropertyExamples
duration-{time}animation-durationduration-500, duration-1000
ease-{type}animation-timing-functionease-linear, ease-in-out
delay-{time}animation-delaydelay-200, delay-500
repeat-{count}animation-iteration-countrepeat-1 (once), repeat-infinite

Examples

1. Spin an Icon

<div class="animate-spin h-10 w-10 border-4 border-blue-500 rounded-full border-t-transparent"></div>
  • Creates a spinning circle loader.


2. Pulse Button

<button class="animate-pulse bg-green-500 text-white px-4 py-2 rounded">  Pulsing Button</button>
  • Button smoothly fades in and out continuously.


3. Bounce Effect

<div class="animate-bounce p-4 bg-yellow-300 rounded">  Bouncing box</div>
  • Element bounces vertically in a loop.


4. Customizing Animation Duration and Delay

<div class="animate-ping duration-1000 delay-500">  Ping with 1s duration and 0.5s delay</div>

Adding Custom Animations

You can define your own animations in tailwind.config.js:

module.exports = {  theme: {    extend: {      animation: {        'wiggle': 'wiggle 1s ease-in-out infinite',      },      keyframes: {        wiggle: {          '0%, 100%': { transform: 'rotate(-3deg)' },          '50%': { transform: 'rotate(3deg)' },        }      }    }  }}

Use:

<div class="animate-wiggle">  Custom wiggle animation</div>

If you want, I can help you create more complex animations or integrate them with interaction states!

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql