animate 0.1.alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/README.md +191 -0
  2. data/lib/animate.rb +9 -0
  3. data/stylesheets/_animate.scss +40 -0
  4. data/stylesheets/_helpers.scss +37 -0
  5. data/stylesheets/animate/_attention.scss +32 -0
  6. data/stylesheets/animate/_bounce.scss +63 -0
  7. data/stylesheets/animate/_fade.scss +52 -0
  8. data/stylesheets/animate/_flip.scss +83 -0
  9. data/stylesheets/animate/_lightSpeed.scss +16 -0
  10. data/stylesheets/animate/_roll.scss +16 -0
  11. data/stylesheets/animate/_rotate.scss +37 -0
  12. data/stylesheets/animate/_special.scss +13 -0
  13. data/stylesheets/animate/attention/_flash.scss +24 -0
  14. data/stylesheets/animate/attention/_pulse.scss +18 -0
  15. data/stylesheets/animate/attention/_shake.scss +43 -0
  16. data/stylesheets/animate/attention/_swing.scss +29 -0
  17. data/stylesheets/animate/attention/_tada.scss +41 -0
  18. data/stylesheets/animate/attention/_wiggle.scss +42 -0
  19. data/stylesheets/animate/attention/_wobble.scss +30 -0
  20. data/stylesheets/animate/bounce/_bounceIn.scss +119 -0
  21. data/stylesheets/animate/bounce/_bounceOut.scss +107 -0
  22. data/stylesheets/animate/fade/_fadeIn.scss +159 -0
  23. data/stylesheets/animate/fade/_fadeOut.scss +159 -0
  24. data/stylesheets/animate/flip/_flipIn.scss +58 -0
  25. data/stylesheets/animate/flip/_flipOut.scss +46 -0
  26. data/stylesheets/animate/lightSpeed/_lightSpeedIn.scss +25 -0
  27. data/stylesheets/animate/lightSpeed/_lightSpeedOut.scss +17 -0
  28. data/stylesheets/animate/roll/_rollIn.scss +17 -0
  29. data/stylesheets/animate/roll/_rollOut.scss +16 -0
  30. data/stylesheets/animate/rotate/_rotateIn.scss +159 -0
  31. data/stylesheets/animate/rotate/_rotateOut.scss +159 -0
  32. data/stylesheets/animate/special/_hinge.scss +38 -0
  33. metadata +134 -0
@@ -0,0 +1,191 @@
1
+ Compass Animate
2
+ ===============
3
+
4
+ This is the new home for
5
+ Eric Meyer's Compass port of
6
+ [animate.css][animate]
7
+ by [Dan Eden][dan].
8
+ It is splitting off from
9
+ [compass-animation][ca]
10
+ because the majority of that plugin
11
+ has moved into [Compass 0.13][c13].
12
+ This plugin is for people on the Compass edge,
13
+ while that plugin remains useful
14
+ to people who are still using Compass 0.12.
15
+
16
+ Compass Animate requires
17
+ Compass 0.13 (currently in alpha).
18
+
19
+ ```bash
20
+ gem install compass-animate
21
+ ```
22
+
23
+ ```ruby
24
+ # config.rb
25
+ @require "animate"
26
+ ```
27
+
28
+ ```scss
29
+ // *.scss
30
+ @import "animate";
31
+ ```
32
+
33
+ [animate]: http://daneden.me/animate/
34
+ [dan]: http://daneden.me/
35
+ [ca]: https://github.com/ericam/compass-animation
36
+ [c13]: http://beta.compass-style.org/reference/compass/css3/animation/
37
+
38
+ ## Usage
39
+
40
+ We try our best to stay up to date
41
+ with the latest from Dan Eden,
42
+ but we've also made a few changes
43
+ and expanded on his base.
44
+
45
+ You can include any number of named animation keyframes,
46
+ each one with or without it's related class name.
47
+
48
+ The most basic option is simply:
49
+
50
+ ```scss
51
+ // Include all the animation keyframes:
52
+ @include animate;
53
+ ```
54
+
55
+ But you can get much more detailed:
56
+
57
+ ```scss
58
+ // Temlate:
59
+ // @include animate[-animationName]([$sub: all, $class: false]);
60
+ ```
61
+
62
+ Let's say you want just the "flash" animation:
63
+
64
+ ```scss
65
+ // Include only the flash animation keyframes
66
+ @include animate-flash;
67
+ ```
68
+
69
+ But you also want a pre-defined class
70
+ that calls that animation:
71
+
72
+ ```scss
73
+ // Include only the flash animation keyframes,
74
+ // with associated class name:
75
+ @include animate-flash($class:true);
76
+ ```
77
+
78
+ That will output:
79
+
80
+ ```css
81
+ @-moz-keyframes flash { 0% { opacity: 1; }
82
+ 25% { opacity: 0; }
83
+ 50% { opacity: 1; }
84
+ 75% { opacity: 0; }
85
+ 100% { opacity: 1; } }
86
+
87
+ @-webkit-keyframes flash { 0% { opacity: 1; }
88
+ 25% { opacity: 0; }
89
+ 50% { opacity: 1; }
90
+ 75% { opacity: 0; }
91
+ 100% { opacity: 1; } }
92
+
93
+ @-o-keyframes flash { 0% { opacity: 1; }
94
+ 25% { opacity: 0; }
95
+ 50% { opacity: 1; }
96
+ 75% { opacity: 0; }
97
+ 100% { opacity: 1; } }
98
+
99
+ @-ms-keyframes flash { 0% { opacity: 1; }
100
+ 25% { opacity: 0; }
101
+ 50% { opacity: 1; }
102
+ 75% { opacity: 0; }
103
+ 100% { opacity: 1; } }
104
+
105
+ @keyframes flash { 0% { opacity: 1; }
106
+ 25% { opacity: 0; }
107
+ 50% { opacity: 1; }
108
+ 75% { opacity: 0; }
109
+ 100% { opacity: 1; } }
110
+
111
+ .flash {
112
+ -webkit-animation-name: flash;
113
+ -moz-animation-name: flash;
114
+ -ms-animation-name: flash;
115
+ -o-animation-name: flash;
116
+ animation-name: flash; }
117
+ ```
118
+
119
+ Now you have the named keyframes
120
+ for the "flash" animation
121
+ and a class name that you can use in your HTML
122
+ or extend with Sass.
123
+
124
+ You can also set `$class` to `silent`
125
+ and get `%flash`
126
+ which can be used with `@extends`
127
+ but won't show up in the css.
128
+
129
+ There are a few shortcuts as well:
130
+
131
+ ```scss
132
+ // this:
133
+ @include animate-fadeIn;
134
+ @include animate-fadeOut;
135
+ @include animate-fadeOutBig;
136
+
137
+ // is equal to this:
138
+ @include animate-fade(in-only out-only outBig);
139
+ ```
140
+
141
+ If you want all the fadeOut animations:
142
+
143
+ ```scss
144
+ @include animate-fade(out);
145
+ ```
146
+
147
+ ## Animations
148
+
149
+ This plugin includes the following _mixins_ & animations:
150
+
151
+ **Attention**
152
+ - _attention_
153
+ - flash, bounce, shake, tada, swing, wobble, wiggle, pulse
154
+
155
+ **Flip** (currently Webkit, Firefox, & IE10 only)
156
+ - flip, _flipX_, _flipY_
157
+ - _flipIn_, flipInX, flipInY
158
+ - _flipOut_, flipOutX, flipOutY
159
+
160
+ **Fade**
161
+ - _fade_
162
+ - fadeIn, fadeInUp, fadeInDown, fadeInLeft, fadeInRight,
163
+ fadeInUpBig, fadeInDownBig, fadeInLeftBig, fadeInRightBig
164
+ - fadeOut, fadeOutUp, fadeOutDown, fadeOutLeft, fadeOutRight,
165
+ fadeOutUpBig, fadeOutDownBig, fadeOutLeftBig, fadeOutRightBig
166
+
167
+ **Bounce**
168
+ - _bounce_
169
+ - bounceIn, bounceInDown, bounceInUp, bounceInLeft, bounceInRight
170
+ - bounceOut, bounceOutDown, bounceOutUp, bounceOutLeft, bounceOutRight
171
+
172
+ **Roll**
173
+ - _roll_
174
+ - rollIn
175
+ - rollOut
176
+
177
+ **Rotate**
178
+ - _rotate_
179
+ - rotateIn, rotateInDownLeft, rotateInDownRight,
180
+ rotateInUpLeft, rotateInUpRight
181
+ - rotateOut, rotateOutDownLeft, rotateOutDownRight,
182
+ rotateOutUpLeft, rotateOutUpRight
183
+
184
+ **Lightspeed**
185
+ - _lightSpeed_
186
+ - lightSpeedIn
187
+ - lightSpeedOut
188
+
189
+ **Special**
190
+ - _special_
191
+ - hinge
@@ -0,0 +1,9 @@
1
+ require 'compass'
2
+ Compass::Frameworks.register("animate", :path => "#{File.dirname(__FILE__)}/..")
3
+
4
+ module Animate
5
+
6
+ VERSION = "0.1"
7
+ DATE = "2012-05-24"
8
+
9
+ end
@@ -0,0 +1,40 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Animations from Animate.css
3
+ // Author : Dan Eden
4
+ // URL : http://daneden.me/animate/
5
+ // ---------------------------------------------------------------------------
6
+ // imports
7
+
8
+ @import "helpers";
9
+
10
+ @import "animate/attention";
11
+ @import "animate/bounce";
12
+ @import "animate/fade";
13
+ @import "animate/flip";
14
+ @import "animate/lightspeed";
15
+ @import "animate/roll";
16
+ @import "animate/rotate";
17
+ @import "animate/special";
18
+
19
+ // ---------------------------------------------------------------------------
20
+ // animate [ attention | bounce | fade | flip |
21
+ // lightSpeed | rotate | special | all ]
22
+
23
+ @mixin animate($sub: all, $class: $default-animation-class-mode) {
24
+ $sub : compact($sub);
25
+ $attention : yepnope($sub, all attention);
26
+ $bounce : yepnope($sub, all bounce);
27
+ $fade : yepnope($sub, all fade);
28
+ $flip : yepnope($sub, all flip);
29
+ $lightSpeed : yepnope($sub, all lightspeed);
30
+ $rotate : yepnope($sub, all rotate);
31
+ $special : yepnope($sub, all special);
32
+ @if $attention { @include animate-attention (all, $class); }
33
+ @if $bounce { @include animate-bounce (all, $class); }
34
+ @if $fade { @include animate-fade (all, $class); }
35
+ @if $flip { @include animate-flip (all, $class); }
36
+ @if $lightSpeed { @include animate-lightSpeed (all, $class); }
37
+ @if $rotate { @include animate-rotate (all, $class); }
38
+ @if $special { @include animate-special (all, $class); }
39
+ }
40
+
@@ -0,0 +1,37 @@
1
+ // ---------------------------------------------------------------------------
2
+ // animation class mode: true | false | silent
3
+
4
+ $default-animation-class-mode: silent !default;
5
+
6
+ // ---------------------------------------------------------------------------
7
+ // animated class for external use
8
+ @mixin animated-class($class: $default-animation-class-mode) {
9
+ $selector: if($class == 'silent', '%animated', '.animated');
10
+ #{$selector} { @include animation(1s ease both); }
11
+ }
12
+
13
+ // ---------------------------------------------------------------------------
14
+ // animation-class
15
+
16
+ @mixin animation-class($name, $class: $default-animation-class-mode) {
17
+ $selector: if($class == 'silent', '%', '.') + $name;
18
+ @if $class {
19
+ #{$selector} {
20
+ @include animation-name($name);
21
+ @content;
22
+ }
23
+ }
24
+ }
25
+
26
+ // ---------------------------------------------------------------------------
27
+ // yepnope
28
+
29
+ // Take a $list, return true if any $args are present.
30
+ @function yepnope($list, $args) {
31
+ $list : compact($list);
32
+ $return : false;
33
+ @each $arg in $args {
34
+ $return: if(index($list,$arg), true, $return);
35
+ }
36
+ @return $return;
37
+ }
@@ -0,0 +1,32 @@
1
+ // ---------------------------------------------------------------------------
2
+ // imports
3
+
4
+ @import "attention/flash";
5
+ @import "attention/shake";
6
+ @import "attention/tada";
7
+ @import "attention/swing";
8
+ @import "attention/wobble";
9
+ @import "attention/pulse";
10
+ @import "attention/wiggle";
11
+
12
+ // ---------------------------------------------------------------------------
13
+ // attention [ flash | shake | tada |
14
+ // swing | wobble | pulse | wiggle ]
15
+
16
+ @mixin animate-attention($sub: all, $class: $default-animation-class-mode) {
17
+ $sub : compact($sub);
18
+ $flash : yepnope($sub, all flash);
19
+ $shake : yepnope($sub, all shake);
20
+ $tada : yepnope($sub, all tada);
21
+ $swing : yepnope($sub, all swing);
22
+ $wobble : yepnope($sub, all wobble);
23
+ $pulse : yepnope($sub, all pulse);
24
+ $wiggle : yepnope($sub, all wiggle);
25
+ @if $flash { @include animate-flash ($class); }
26
+ @if $shake { @include animate-shake ($class); }
27
+ @if $tada { @include animate-tada ($class); }
28
+ @if $swing { @include animate-swing ($class); }
29
+ @if $wobble { @include animate-wobble ($class); }
30
+ @if $pulse { @include animate-pulse ($class); }
31
+ @if $wiggle { @include animate-wiggle ($class); }
32
+ }
@@ -0,0 +1,63 @@
1
+ // ---------------------------------------------------------------------------
2
+ // imports
3
+
4
+ @import "bounce/bounceIn";
5
+ @import "bounce/bounceOut";
6
+
7
+ // ---------------------------------------------------------------------------
8
+ // bounce [ in | inUp | inDown | inLeft | inRight |
9
+ // out | outUp | outDown | outLeft | outRight |
10
+ // up | down | left | right | only | all ]
11
+
12
+ @mixin animate-bounce($sub: all, $class: $default-animation-class-mode) {
13
+ $sub : compact($sub);
14
+ $only : yepnope($sub, all only);
15
+ $in : yepnope($sub, all in);
16
+ $inUp : yepnope($sub, all in inUp up);
17
+ $inDown : yepnope($sub, all in inDown down);
18
+ $inLeft : yepnope($sub, all in inLeft left);
19
+ $inRight : yepnope($sub, all in inRight right);
20
+ $out : yepnope($sub, all out);
21
+ $outUp : yepnope($sub, all out outUp up);
22
+ $outDown : yepnope($sub, all out outDown down);
23
+ $outLeft : yepnope($sub, all out outLeft left);
24
+ $outRight : yepnope($sub, all out outRight right);
25
+ @if $in { @include animate-bounceIn ($class); }
26
+ @if $inUp { @include animate-bounceInUp ($class); }
27
+ @if $inDown { @include animate-bounceInDown ($class); }
28
+ @if $inLeft { @include animate-bounceInLeft ($class); }
29
+ @if $inRight { @include animate-bounceInRight ($class); }
30
+ @if $out { @include animate-bounceOut ($class); }
31
+ @if $outUp { @include animate-bounceOutUp ($class); }
32
+ @if $outDown { @include animate-bounceOutDown ($class); }
33
+ @if $outLeft { @include animate-bounceOutLeft ($class); }
34
+ @if $outRight { @include animate-bounceOutRight ($class); }
35
+
36
+ $name: bounce;
37
+ @if $only {
38
+ @include keyframes($name) {
39
+ 0% {
40
+ @include translateY(0);
41
+ }
42
+ 20% {
43
+ @include translateY(0);
44
+ }
45
+ 40% {
46
+ @include translateY(-30px);
47
+ }
48
+ 50% {
49
+ @include translateY(0);
50
+ }
51
+ 60% {
52
+ @include translateY(-15px);
53
+ }
54
+ 80% {
55
+ @include translateY(0);
56
+ }
57
+ 100% {
58
+ @include translateY(0);
59
+ }
60
+ }
61
+ @include animation-class($name, $class) {}
62
+ }
63
+ }
@@ -0,0 +1,52 @@
1
+ // ---------------------------------------------------------------------------
2
+ // imports
3
+
4
+ @import "fade/fadeIn";
5
+ @import "fade/fadeOut";
6
+
7
+ // ---------------------------------------------------------------------------
8
+ // fade [ in | inUp | inDown | inLeft | inRight |
9
+ // inUpBig | inDownBig | inLeftBig | inRightBig |
10
+ // out | outUp | outDown | outLeft | outRight |
11
+ // outUpBig | outDownBig | outLeftBig | outRightBig |
12
+ // up | down | left | right | big | all ]
13
+
14
+ @mixin animate-fade($sub: all, $class: $default-animation-class-mode) {
15
+ $sub : compact($sub);
16
+ $in : yepnope($sub, all in);
17
+ $inUp : yepnope($sub, all in inUp up);
18
+ $inDown : yepnope($sub, all in inDown down);
19
+ $inLeft : yepnope($sub, all in inLeft left);
20
+ $inRight : yepnope($sub, all in inRight right);
21
+ $inUpBig : yepnope($sub, all in inUp up big);
22
+ $inDownBig : yepnope($sub, all in inDown down big);
23
+ $inLeftBig : yepnope($sub, all in inLeft left big);
24
+ $inRightBig : yepnope($sub, all in inRight right big);
25
+ $out : yepnope($sub, all out);
26
+ $outUp : yepnope($sub, all out outUp up);
27
+ $outDown : yepnope($sub, all out outDown down);
28
+ $outLeft : yepnope($sub, all out outLeft left);
29
+ $outRight : yepnope($sub, all out outRight right);
30
+ $outUpBig : yepnope($sub, all out outUp up big);
31
+ $outDownBig : yepnope($sub, all out outDown down big);
32
+ $outLeftBig : yepnope($sub, all out outLeft left big);
33
+ $outRightBig : yepnope($sub, all out outRight right big);
34
+ @if $in { @include animate-fadeIn ($class); }
35
+ @if $inUp { @include animate-fadeInUp ($class); }
36
+ @if $inDown { @include animate-fadeInDown ($class); }
37
+ @if $inLeft { @include animate-fadeInLeft ($class); }
38
+ @if $inRight { @include animate-fadeInRight ($class); }
39
+ @if $inUpBig { @include animate-fadeInUpBig ($class); }
40
+ @if $inDownBig { @include animate-fadeInDownBig ($class); }
41
+ @if $inLeftBig { @include animate-fadeInLeftBig ($class); }
42
+ @if $inRightBig { @include animate-fadeInRightBig ($class); }
43
+ @if $out { @include animate-fadeOut ($class); }
44
+ @if $outUp { @include animate-fadeOutUp ($class); }
45
+ @if $outDown { @include animate-fadeOutDown ($class); }
46
+ @if $outLeft { @include animate-fadeOutLeft ($class); }
47
+ @if $outRight { @include animate-fadeOutRight ($class); }
48
+ @if $outUpBig { @include animate-fadeOutUpBig ($class); }
49
+ @if $outDownBig { @include animate-fadeOutDownBig ($class); }
50
+ @if $outLeftBig { @include animate-fadeOutLeftBig ($class); }
51
+ @if $outRightBig { @include animate-fadeOutRightBig ($class); }
52
+ }
@@ -0,0 +1,83 @@
1
+ // ---------------------------------------------------------------------------
2
+ // special class handling
3
+
4
+ @mixin flip-class($name, $class: $default-animation-class-mode) {
5
+ @include animation-class($name, $class) {
6
+ @include backface-visibility(visible);
7
+ }
8
+ }
9
+
10
+ // ---------------------------------------------------------------------------
11
+ // imports
12
+
13
+ @import "flip/flipIn";
14
+ @import "flip/flipOut";
15
+
16
+ // ---------------------------------------------------------------------------
17
+ // flip [ only | in | out | x | y | all |
18
+ // flipIn | flipInX | flipInY |
19
+ // flipOut | flipOutX | flipOutY |
20
+ // flipX | flipY ]
21
+
22
+ @mixin animate-flip($sub: all, $class: $default-animation-class-mode) {
23
+ $sub : compact($sub);
24
+ $only : yepnope($sub, all only);
25
+ $flipInX : yepnope($sub, all flipIn flipInX flipX in x);
26
+ $flipInY : yepnope($sub, all flipIn flipInY flipY in y);
27
+ $flipOutX : yepnope($sub, all flipOut flipOutX flipX out x);
28
+ $flipOutY : yepnope($sub, all flipOut flipOutY flipY out y);
29
+
30
+ @if $flipInX { @include animate-flipInX ($class); }
31
+ @if $flipInY { @include animate-flipInY ($class); }
32
+ @if $flipOutX { @include animate-flipOutX ($class); }
33
+ @if $flipOutY { @include animate-flipOutY ($class); }
34
+
35
+ $name: flip;
36
+ @if $only {
37
+ @include keyframes($name) {
38
+ 0% {
39
+ @include transform(perspective(400px) rotateY(0));
40
+ @include animation-timing-function(ease-out);
41
+ }
42
+ 40% {
43
+ @include transform(perspective(400px) translateZ(150px) rotateY(170deg));
44
+ @include animation-timing-function(ease-out);
45
+ }
46
+ 50% {
47
+ @include transform(perspective(400px) translateZ(150px) rotateY(190deg) scale(1));
48
+ @include animation-timing-function(ease-in);
49
+ }
50
+ 80% {
51
+ @include transform(perspective(400px) rotateY(360deg) scale(0.95));
52
+ @include animation-timing-function(ease-in);
53
+ }
54
+ 100% {
55
+ @include transform(perspective(400px) scale(1));
56
+ @include animation-timing-function(ease-in);
57
+ }
58
+ }
59
+ @include flip-class($name, $class);
60
+ }
61
+ }
62
+
63
+ // ---------------------------------------------------------------------------
64
+ // flipX [ in | out | all ]
65
+
66
+ @mixin animate-flipX($sub: all, $class: $default-animation-class-mode) {
67
+ $sub : compact($sub);
68
+ $in : yepnope($sub, all in);
69
+ $out : yepnope($sub, all out);
70
+ @if $in { @include animate-flipInX (all, $class); }
71
+ @if $out { @include animate-flipOutX (all, $class); }
72
+ }
73
+
74
+ // ---------------------------------------------------------------------------
75
+ // flipY [ in | out | all ]
76
+
77
+ @mixin animate-flipY($sub: all, $class: $default-animation-class-mode) {
78
+ $sub : compact($sub);
79
+ $in : yepnope($sub, all in);
80
+ $out : yepnope($sub, all out);
81
+ @if $in { @include animate-flipInY (all, $class); }
82
+ @if $out { @include animate-flipOutY (all, $class); }
83
+ }