explaingit

minimac/magic

8,600SCSSAudience · developerComplexity · 1/5Setup · easy

TLDR

A tiny CSS library that adds animated visual effects to webpage elements by applying class names, covering over a dozen animation styles, all in 3.1 KB compressed.

Mindmap

mindmap
  root((repo))
    What it does
      CSS animations
      Class-based API
      3.1 KB size
    Animation types
      Appear and vanish
      Slide effects
      Perspective tilts
      Bomb Boing Space
    Tech
      SCSS source
      Gulp build
      jQuery support
    Setup
      npm or Yarn
      Link CSS file
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add entrance and exit animations to buttons or modals by applying two CSS class names.

USE CASE 2

Trigger animations on hover with a few lines of JavaScript or jQuery.

USE CASE 3

Customize which animations to include by editing the SCSS source and rebuilding with Gulp.

Tech stack

SCSSCSSJavaScriptjQueryGulp

Getting it running

Difficulty · easy Time to first run · 5min
No license information was provided in the explanation.

In plain English

Magic.css is a small CSS library that adds animated visual effects to elements on a webpage. The library weighs about 3.1 kilobytes when compressed, which is very lightweight for what it provides. It works by adding CSS class names to HTML elements: you give an element the class magictime plus the name of a specific animation, and the element plays that animation. The available animations fall into several named groups: effects with names like puffIn, vanishOut, and swapIn for appearing and disappearing, slide effects that move elements from different directions, perspective effects that tilt elements toward or away from the viewer, and more dramatic effects grouped under names like Bomb, Boing, and Space. The full list of animation class names is documented in a table in the README. You can trigger these animations through plain JavaScript by adding the class names in code, or through jQuery using similar methods. The README includes short code examples for common patterns: playing an animation on hover, playing it after a delay, or repeating it on an interval. Animation timing defaults to one second but can be changed by overriding the magictime CSS class or by targeting a specific animation class. The source is written in SCSS (a CSS preprocessor format), and a Gulp build step is included so you can customize which animations to include before generating the final CSS files. The library supports modern versions of Chrome, Firefox, Safari, Opera, and Android browsers, but not Opera Mini. Installation is through npm or Yarn. The package can also be used by downloading the compiled CSS file and linking to it directly in an HTML page.

Copy-paste prompts

Prompt 1
Show me how to use magic.css to make a div fly in from the left when the page loads.
Prompt 2
Write JavaScript that plays a puffIn animation on a button every time it is clicked using magic.css.
Prompt 3
How do I change the default 1-second animation duration in magic.css to 0.3 seconds globally?
Prompt 4
Give me an example of repeating a magic.css animation on a 3-second interval using setInterval.
Open on GitHub → Explain another repo

← minimac on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.