Skip to content

Simple animations

This component provides a comprehensive set of CSS animation utilities for Metro UI components and elements.

The animations component defines various animation classes and keyframes that can be applied to elements to create visual effects. These animations can be triggered on page load or on hover.

The file defines several CSS variables for animation durations and easing functions:

VariableValue
--base-duration-00ms
--base-duration-100100ms
--base-duration-200200ms
--base-duration-300300ms
--base-duration-400400ms
--base-duration-500500ms
--base-duration-600600ms
--base-duration-700700ms
--base-duration-800800ms
--base-duration-900900ms
--base-duration-10001s
VariableValue
--base-easing-linearcubic-bezier(0, 0, 1, 1)
--base-easing-easeIncubic-bezier(0.7, 0.1, 0.75, 0.9)
--base-easing-easeOutcubic-bezier(0.3, 0.8, 0.6, 1)
--base-easing-easeInOutcubic-bezier(0.6, 0, 0.2, 1)

The file provides two types of animation classes:

  1. .ani-[animation-name] - Animation starts immediately when applied
  2. .ani-hover-[animation-name]:hover - Animation starts when element is hovered
ClassDescription
.ani-spin, .ani-hover-spin:hoverRotates element 360 degrees continuously
.ani-spin-reverse, .ani-hover-spin-reverse:hoverRotates element counter-clockwise continuously
.ani-pulse, .ani-hover-pulse:hoverPulses the element with rotation
.ani-spanner, .ani-hover-spanner:hoverApplies a wrench-like rotation animation
.ani-ring, .ani-hover-ring:hoverApplies a bell-ringing animation
.ani-vertical, .ani-hover-vertical:hoverMoves element up and down
.ani-horizontal, .ani-hover-horizontal:hoverMoves element left and right
.ani-flash, .ani-hover-flash:hoverMakes element flash by changing opacity
.ani-bounce, .ani-hover-bounce:hoverMakes element bounce up and down
.ani-float, .ani-hover-float:hoverMakes element float up and down smoothly
.ani-heartbeat, .ani-hover-heartbeat:hoverSimulates a heartbeat by scaling element
.ani-shake, .ani-hover-shake:hoverShakes element back and forth
.ani-shuttle, .ani-hover-shuttle:hoverApplies a shuttle-like rotation and scaling
.ani-pass, .ani-hover-pass:hoverMakes element pass from left to right
.ani-ripple, .ani-hover-ripple:hoverCreates a ripple effect by scaling and fading

The file defines keyframe animations for each of the animation classes, as well as some additional utility keyframes:

  • @keyframes swinging
  • @keyframes scaleout
  • @keyframes cubemove
  • @keyframes orbit
  • @keyframes metro-slide
  • @keyframes metro-opacity
  • @keyframes ani-spin
  • @keyframes ani-spin-reverse
  • @keyframes ani-pulse
  • @keyframes ani-wrench
  • @keyframes ani-ring
  • @keyframes ani-vertical
  • @keyframes ani-horizontal
  • @keyframes ani-flash
  • @keyframes ani-bounce
  • @keyframes ani-float
  • @keyframes ani-heartbeat
  • @keyframes ani-shuttle
  • @keyframes ani-pass
  • @keyframes ani-ripple
  • @keyframes ani-shrink
  • @keyframes ani-pre-spin
  • @keyframes ani-bg-stripes
  • @keyframes slideUp
  • @keyframes slideDown
<!-- Spinning element -->
<div class="ani-spin">This element will spin continuously</div>
<!-- Element that spins on hover -->
<div class="ani-hover-spin">This element will spin when hovered</div>
<!-- Bouncing element -->
<button class="ani-bounce">Bouncing Button</button>
<!-- Floating icon -->
<span class="icon ani-float">⚙️</span>

You can combine these animation classes with other Metro UI classes to create engaging user interfaces.