• Stars
    star
    362
  • Rank 117,671 (Top 3 %)
  • Language
    CSS
  • License
    Other
  • Created almost 13 years ago
  • Updated about 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

css3 animation plugin for compass

This plugin is mainly for adding animations to older versions of Compass.

  • The latset version of Compass has this code merged in, so there's no need for this plugin. We're not updating it anymore.
  • If you are looking for Dan Eden's Animate.css ported to Compass, try the compass-animate plugin.

Animation Compass Plugin

First and foremost, this plugin gives you all the tools you need to write and apply css3 animations in compass. As a bonus, and only if you so choose, it also supplies you with a "shit-ton" (roughly 2 metric tons) of pre-fabricated animations taken from Dan Eden's "Animate.css" project.

This plugin requires Sass 3.2 and Compass 0.12

gem install animation --pre

require 'animation'

@import "animation";

Animation

The default import only includes the core mixins for creating animations. That covers all the expected properties, to be used exactly as you would in CSS:

// create your animation
@include keyframes($name) {
  @content;
}

// apply animation(s) and adjust settings
@include animation-name([$name-1, $name-2, ..., $name-10]);
@include animation-duration([$duration-1, $duration-2, ..., $duration-10]);
@include animation-delay([$delay-1, $delay-2, ..., $delay-10]);
@include animation-timing-function([$function-1, $function-2, ..., $function-10]);
@include animation-iteration-count([$count-1, $count-2, ..., $count-10]);
@include animation-direction([$direction-1, $direction-2, ..., $direction-10]);
@include animation-fill-mode([$mode-1, $mode-2, ..., $mode-10]);
@include animation-play-state([$state-1, $state-2, ..., $state-10]);

// shortcut to apply and adjust
@include animation([$animation-1, $animation-2, ..., animation-10]);

There are default variables available for all of them:

$default-animation-name             : false;
$default-animation-duration         : false;
$default-animation-delay            : false;
$default-animation-timing-function  : false;
$default-animation-iteration-count  : false;
$default-animation-direction        : false;
$default-animation-fill-mode        : false;
$default-animation-play-state       : false;

For Example

Say you want to create your own animation. Start with the keyframes:

@include keyframes(my-animation) {
  0%, 100% {
    background-color: blue;
  }
  50% {
    background-color: red;
  }
}

That animation will change the background color from blue to red to blue again. Now let's apply it to something:

body {
  @include animation(my-animation 10s infinite);
}

Compare that to the official CSS spec:

@keyframes my-animation {
  0%, 100% {
    background-color: blue;
  }
  50% {
    background-color: red;
  }
}

body {
  animation: my-animation 10s infinite;
}

Pretty much identical. You're just using include/argument pairs instead of property/value pairs.

Animate.css

Because the Animate code creates output, you need to import it (or one of it's sob-modules) directly:

@import "animation/animate";

That will create the following named animations:

  • Attention seekers
    • flash, bounce, shake, tada, swing, wobble, wiggle, pulse
  • Flippers (currently Webkit, Firefox, & IE10 only)
    • flip, flipInX, flipOutX, flipInY, flipOutY
  • Fading entrances
    • fadeIn, fadeInUp, fadeInDown, fadeInLeft, fadeInRight, fadeInUpBig, fadeInDownBig, fadeInLeftBig, fadeInRightBig
  • Fading exits
    • fadeOut, fadeOutUp, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUpBig, fadeOutDownBig, fadeOutLeftBig, fadeOutRightBig
  • Bouncing entrances
    • bounceIn, bounceInDown, bounceInUp, bounceInLeft, bounceInRight
  • Bouncing exits
    • bounceOut, bounceOutDown, bounceOutUp, bounceOutLeft, bounceOutRight
  • Rotating entrances
    • rotateIn, rotateInDownLeft, rotateInDownRight, rotateInUpLeft, rotateInUpRight
  • Rotating exits
    • rotateOut, rotateOutDownLeft, rotateOutDownRight, rotateOutUpLeft, rotateOutUpRight
  • Lightspeed
    • lightSpeedIn, lightSpeedOut
  • Specials
    • hinge, rollIn, rollOut

You can use them like this:

.widget {
  @include animation(fadeIn);
}

You can also import a set of predefined classes for each animation:

@import "animation/animate/classes";

With those classes imported, you can simply add the class of fadeIn to any element, and watch it do the magic.

That's all there is to it.

More Repositories

1

compass-animate

Compass port of Dan Eden's Animate.css
CSS
270
star
2

compass-css-lightbox

a css-only lightbox implementation for compass
CSS
74
star
3

compass-css-slideshow

a css-only slideshow implementation for compass
Ruby
51
star
4

webfontspecimen

An adaptation of Tim Brown's Web Font Specimen for Compass
Ruby
32
star
5

mia

eleventy source for miriamsuzanne.com
Nunjucks
25
star
6

teacup

the new new teacup gorilla
Nunjucks
17
star
7

meaningful-css

Presentation for Denver HTML5 Users Group, April 2012
Ruby
14
star
8

miriamsuzanne

miriamsuzanne.com source
CSS
13
star
9

front-end-social

About pages for front-end.social mastodon
SCSS
7
star
10

web-component-template

a template for web components
HTML
5
star
11

ground-control

Use input/select or toggle buttons to control UI elements
JavaScript
4
star
12

pres

css presentation thingy
CSS
4
star
13

remedocs

an experiment in offsite documentation
SCSS
3
star
14

aaron-liechty

A tumblr theme for Aaron Liechty's illustration portfolio
Ruby
3
star
15

aliceandmia

The future online home for Alice & Mia
CSS
3
star
16

mayiuse

like caniuse, but for permission instead of data
CSS
3
star
17

business-business

For important business
SCSS
2
star
18

track-list

Enhance a list of audio tracks with playlist controls
JavaScript
2
star
19

nsa

Ask not what the NSA can do for you...
2
star
20

sidesaddle

Riding SideSaddle*
CSS
2
star
21

GreenMud-Fonts

handdrawn fonts for Into The Green Green Mud
2
star
22

post-obsolete

The Obsolete Book in a Post-Obsolete World, as Represented by a Post-Obsolete Book About Dance.
HTML
2
star
23

monkey-typr

Infinite Monkeys want to type the classics, and we're making it possible.
CSS
2
star
24

mirisuzanne.github.io

old personal site
HTML
2
star
25

monkey-write

a web component for typing any pre-defined text
HTML
1
star
26

eight-ball

A magic eight ball returns one of several options after shaking
HTML
1
star
27

sublime-oddmix-theme

Sublime Text 3 Theme — Based on Numix
1
star
28

clocks

Tools for designing and understanding clockwork
HTML
1
star
29

art-is-for-people

No One Wants Your Media Arts — Brakhage Center Lecture, 2013
CSS
1
star
30

capitalism

HTML
1
star
31

tweet-archive

JavaScript
1
star
32

buntmoney

fundraising page for buntport
CSS
1
star
33

ideao.club

idea-o club-o official* web presence
CSS
1
star
34

queer-stage

a stylesheet for https://stylestage.moderncss.dev/
CSS
1
star
35

cakeormaybepie.club

cake (or maybe pie) club
CSS
1
star
36

dirtcircledogs

the new dirtcricledogs.com
HTML
1
star
37

serialy-sassy

Yaml and Json Deserializers for sass
Ruby
1
star
38

teacupgorilla

website for Teacup Gorilla
CSS
1
star