foundation-rails 6.1.1.1 → 6.1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/Rakefile +6 -4
- data/bower.json +2 -1
- data/lib/foundation/rails/version.rb +1 -1
- data/lib/generators/foundation/install_generator.rb +13 -12
- data/lib/generators/foundation/templates/foundation_and_overrides.scss +3 -3
- data/vendor/assets/js/foundation.js +1 -1
- data/vendor/assets/scss/motion-ui/_classes.scss +102 -0
- data/vendor/assets/scss/motion-ui/_settings.scss +61 -0
- data/vendor/assets/scss/motion-ui/effects/_fade.scss +29 -0
- data/vendor/assets/scss/motion-ui/effects/_hinge.scss +65 -0
- data/vendor/assets/scss/motion-ui/effects/_shake.scss +15 -0
- data/vendor/assets/scss/motion-ui/effects/_slide.scss +41 -0
- data/vendor/assets/scss/motion-ui/effects/_spin.scss +28 -0
- data/vendor/assets/scss/motion-ui/effects/_wiggle.scss +13 -0
- data/vendor/assets/scss/motion-ui/effects/_zoom.scss +15 -0
- data/vendor/assets/scss/motion-ui/motion-ui.scss +29 -0
- data/vendor/assets/scss/motion-ui/transitions/_fade.scss +28 -0
- data/vendor/assets/scss/motion-ui/transitions/_hinge.scss +43 -0
- data/vendor/assets/scss/motion-ui/transitions/_slide.scss +42 -0
- data/vendor/assets/scss/motion-ui/transitions/_spin.scss +39 -0
- data/vendor/assets/scss/motion-ui/transitions/_zoom.scss +39 -0
- data/vendor/assets/scss/motion-ui/util/_animation.scss +7 -0
- data/vendor/assets/scss/motion-ui/util/_args.scss +15 -0
- data/vendor/assets/scss/motion-ui/util/_keyframe.scss +136 -0
- data/vendor/assets/scss/motion-ui/util/_selector.scss +23 -0
- data/vendor/assets/scss/motion-ui/util/_series.scss +54 -0
- data/vendor/assets/scss/motion-ui/util/_transition.scss +45 -0
- data/vendor/assets/scss/motion-ui/util/_unit.scss +7 -0
- metadata +24 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d79edccd460fb3cf16526f278c2ebda7dca1918
|
4
|
+
data.tar.gz: 7c9cbe0bb4d31a3c828f42dcc0e1bc7f3dcbd5b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59f23edecc5f15f85cf64cdd02815df79db64a4ad86675b01fcb44869d306c963da64c3be02ef57a0a8c1b93d180fb0d3d0c34c6e7f2cd81c270cd918f4f2dd9
|
7
|
+
data.tar.gz: 2b7292b15665471a1b58ea2112a07f5f78d6df9c24692294f959c80ff38b2e53333471cf0352d4ed79eb14e0d71e714174d350c7d1c2aec4500ac8fb33495912
|
data/README.md
CHANGED
@@ -24,6 +24,16 @@ You can run the following command to add Foundation:
|
|
24
24
|
|
25
25
|
$ rails g foundation:install
|
26
26
|
|
27
|
+
To generate Haml or Slim instead of erb, append the `--haml` or `--slim` options to the above command, respectively.
|
28
|
+
|
29
|
+
### Motion-UI
|
30
|
+
|
31
|
+
[Motion UI](https://github.com/zurb/motion-ui) is a Sass library for creating flexible UI transitions and animations, and it comes packaged with the `foundation-rails` gem. To use Motion UI, uncomment the following lines from `foundation_and_overrides.scss`:
|
32
|
+
|
33
|
+
// @import 'motion-ui/motion-ui';
|
34
|
+
// @include motion-ui-transitions;
|
35
|
+
// @include motion-ui-animations;
|
36
|
+
|
27
37
|
## Manual Installation
|
28
38
|
|
29
39
|
### Add Foundation to your CSS
|
data/Rakefile
CHANGED
@@ -13,10 +13,12 @@ namespace :assets do
|
|
13
13
|
sh 'bower install'
|
14
14
|
sh 'cp -R bower_components/foundation-sites/js/* vendor/assets/js/'
|
15
15
|
sh 'cp -R bower_components/foundation-sites/scss/* vendor/assets/scss/'
|
16
|
+
sh 'cp -R bower_components/motion-ui/src/* vendor/assets/scss/motion-ui'
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
js_files = Dir['vendor/assets/js/*.js'].sort
|
19
|
+
# Move foundation.core.js to beginning of js_files
|
20
|
+
js_files.insert(0, js_files.delete(js_files.find { |file| file[/foundation.core.js/] }))
|
21
|
+
manifest = js_files.map { |file| "//= require #{File.basename(file, '.js')}" }.join("\n")
|
20
22
|
File.write('vendor/assets/js/foundation.js', manifest)
|
21
23
|
|
22
24
|
puts 'Now update version.rb'
|
@@ -25,7 +27,7 @@ namespace :assets do
|
|
25
27
|
desc 'Remove old Foundation for Sites assets'
|
26
28
|
task :clean do
|
27
29
|
sh 'rm -rf vendor'
|
28
|
-
sh 'mkdir -p vendor/assets/js/ vendor/assets/scss'
|
30
|
+
sh 'mkdir -p vendor/assets/js/ vendor/assets/scss vendor/assets/scss/motion-ui'
|
29
31
|
end
|
30
32
|
|
31
33
|
end
|
data/bower.json
CHANGED
@@ -3,11 +3,12 @@ require 'rails/generators'
|
|
3
3
|
module Foundation
|
4
4
|
module Generators
|
5
5
|
class InstallGenerator < ::Rails::Generators::Base
|
6
|
-
|
7
|
-
|
6
|
+
desc "Install Foundation within a Rails project"
|
7
|
+
source_root File.join(File.dirname(__FILE__), "templates")
|
8
|
+
argument :layout_name, :type => :string, :default => "application", :banner => "layout_name"
|
8
9
|
|
9
|
-
class_option :haml, :desc =>
|
10
|
-
class_option :slim, :desc =>
|
10
|
+
class_option :haml, :desc => "Generate Haml layout instead of erb", :type => :boolean
|
11
|
+
class_option :slim, :desc => "Generate Slim layout instead of erb", :type => :boolean
|
11
12
|
|
12
13
|
def add_assets
|
13
14
|
# rails_ujs breaks, need to incorporate rails-behavior plugin for this to work seamlessly
|
@@ -44,17 +45,17 @@ module Foundation
|
|
44
45
|
|
45
46
|
def create_layout
|
46
47
|
if options.haml? || (defined?(Haml) && options.haml?)
|
47
|
-
template
|
48
|
+
template "application.html.haml", File.join(layouts_base_dir, "#{file_name}.html.haml")
|
48
49
|
elsif options.slim? || (defined?(Slim) && options.slim?)
|
49
|
-
template
|
50
|
+
template "application.html.slim", File.join(layouts_base_dir, "#{file_name}.html.slim")
|
50
51
|
else
|
51
|
-
template
|
52
|
+
template "application.html.erb", File.join(layouts_base_dir, "#{file_name}.html.erb")
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
55
56
|
def create_app_scss
|
56
|
-
template
|
57
|
-
template
|
57
|
+
template "foundation_and_overrides.scss", File.join(stylesheets_base_dir, "foundation_and_overrides.scss")
|
58
|
+
template "_settings.scss", File.join(stylesheets_base_dir, "_settings.scss")
|
58
59
|
end
|
59
60
|
|
60
61
|
private
|
@@ -64,15 +65,15 @@ module Foundation
|
|
64
65
|
end
|
65
66
|
|
66
67
|
def javascripts_base_dir
|
67
|
-
File.join(
|
68
|
+
File.join("app", "assets", "javascripts")
|
68
69
|
end
|
69
70
|
|
70
71
|
def stylesheets_base_dir
|
71
|
-
File.join(
|
72
|
+
File.join("app", "assets", "stylesheets")
|
72
73
|
end
|
73
74
|
|
74
75
|
def layouts_base_dir
|
75
|
-
File.join(
|
76
|
+
File.join("app", "views", "layouts")
|
76
77
|
end
|
77
78
|
end
|
78
79
|
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
// If you'd like to include motion-ui, you need to install the motion-ui sass package.
|
7
7
|
//
|
8
|
-
|
8
|
+
// @import 'motion-ui/motion-ui';
|
9
9
|
|
10
10
|
// We include everything by default. To slim your CSS, remove components you don't use.
|
11
11
|
|
@@ -47,5 +47,5 @@
|
|
47
47
|
|
48
48
|
// If you'd like to include motion-ui, you need to install the motion-ui sass package.
|
49
49
|
//
|
50
|
-
|
51
|
-
|
50
|
+
// @include motion-ui-transitions;
|
51
|
+
// @include motion-ui-animations;
|
@@ -0,0 +1,102 @@
|
|
1
|
+
// scss-lint:disable ImportantRule, SpaceAfterComma, SingleLinePerProperty
|
2
|
+
|
3
|
+
%mui-defaults {
|
4
|
+
transition-duration: map-get($motion-ui-speeds, default);
|
5
|
+
transition-timing-function: map-get($motion-ui-easings, default);
|
6
|
+
}
|
7
|
+
|
8
|
+
// Transitions
|
9
|
+
// - - - - - - - - - - - - - - -
|
10
|
+
@mixin motion-ui-transitions {
|
11
|
+
// Slide
|
12
|
+
.slide-in-down { @include mui-slide(in, down); }
|
13
|
+
.slide-in-left { @include mui-slide(in, right); }
|
14
|
+
.slide-in-up { @include mui-slide(in, bottom); }
|
15
|
+
.slide-in-right { @include mui-slide(in, left); }
|
16
|
+
.slide-out-down { @include mui-slide(out, down); }
|
17
|
+
.slide-out-right { @include mui-slide(out, right); }
|
18
|
+
.slide-out-up { @include mui-slide(out, top); }
|
19
|
+
.slide-out-left { @include mui-slide(out, left); }
|
20
|
+
|
21
|
+
// Fade
|
22
|
+
.fade-in { @include mui-fade(in, 0, 1); }
|
23
|
+
.fade-out { @include mui-fade(out, 1, 0); }
|
24
|
+
|
25
|
+
// Hinge
|
26
|
+
.hinge-in-from-top { @include mui-hinge(in, top); }
|
27
|
+
.hinge-in-from-right { @include mui-hinge(in, right); }
|
28
|
+
.hinge-in-from-bottom { @include mui-hinge(in, bottom); }
|
29
|
+
.hinge-in-from-left { @include mui-hinge(in, left); }
|
30
|
+
.hinge-in-from-middle-x { @include mui-hinge(in, top, center); }
|
31
|
+
.hinge-in-from-middle-y { @include mui-hinge(in, right, center); }
|
32
|
+
.hinge-out-from-top { @include mui-hinge(out, top); }
|
33
|
+
.hinge-out-from-right { @include mui-hinge(out, right); }
|
34
|
+
.hinge-out-from-bottom { @include mui-hinge(out, bottom); }
|
35
|
+
.hinge-out-from-left { @include mui-hinge(out, left); }
|
36
|
+
.hinge-out-from-middle-x { @include mui-hinge(out, top, center); }
|
37
|
+
.hinge-out-from-middle-y { @include mui-hinge(out, right, center); }
|
38
|
+
|
39
|
+
// Scale
|
40
|
+
.scale-in-up { @include mui-zoom(in, 0.5, 1); }
|
41
|
+
.scale-in-down { @include mui-zoom(in, 1.5, 1); }
|
42
|
+
.scale-out-up { @include mui-zoom(out, 1, 1.5); }
|
43
|
+
.scale-out-down { @include mui-zoom(out, 1, 0.5); }
|
44
|
+
|
45
|
+
// Spin
|
46
|
+
.spin-in { @include mui-spin(in, cw); }
|
47
|
+
.spin-out { @include mui-spin(out, cw); }
|
48
|
+
.spin-in-ccw { @include mui-spin(in, ccw); }
|
49
|
+
.spin-out-ccw { @include mui-spin(out, ccw); }
|
50
|
+
|
51
|
+
// Transition Modifiers
|
52
|
+
// - - - - - - - - - - - - - - -
|
53
|
+
|
54
|
+
@each $name, $value in $motion-ui-speeds {
|
55
|
+
@if $name != default {
|
56
|
+
.#{$name} { transition-duration: $value !important; }
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
@each $name, $value in $motion-ui-easings {
|
61
|
+
@if $name != default {
|
62
|
+
.#{$name} { transition-timing-function: $value !important; }
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
@each $name, $value in $motion-ui-delays {
|
67
|
+
@if $name != default {
|
68
|
+
.#{$name}-delay { transition-delay: $value !important; }
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
// Animations
|
74
|
+
// - - - - - - - - - - - - - - -
|
75
|
+
@mixin motion-ui-animations {
|
76
|
+
.shake { @include mui-animation(shake); }
|
77
|
+
.spin-cw { @include mui-animation(spin); }
|
78
|
+
.spin-ccw { @include mui-animation(spin(ccw)); }
|
79
|
+
.wiggle { @include mui-animation(wiggle); }
|
80
|
+
|
81
|
+
// Animation Modifiers
|
82
|
+
// - - - - - - - - - - - - - - -
|
83
|
+
.infinite { animation-iteration-count: infinite; }
|
84
|
+
|
85
|
+
@each $name, $value in $motion-ui-speeds {
|
86
|
+
@if $name != default {
|
87
|
+
.#{$name} { animation-duration: $value !important; }
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
@each $name, $value in $motion-ui-easings {
|
92
|
+
@if $name != default {
|
93
|
+
.#{$name} { animation-timing-function: $value !important; }
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
@each $name, $value in $motion-ui-delays {
|
98
|
+
@if $name != default {
|
99
|
+
.#{$name}-delay { animation-delay: $value !important; }
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
/// Format for CSS classes created with Motion UI.
|
2
|
+
/// @type Map
|
3
|
+
/// @prop {Boolean} append [true] - Defines if selectors are chained to the selector (`.class.enter`), or appended as a new class (`.class-enter`).
|
4
|
+
/// @prop {String} prefix ['mui-'] - Prefix to add before the state of a class. Enter an empty string to use no prefix.
|
5
|
+
/// @prop {String} prefix ['-active'] - Suffix to add to the active state class.
|
6
|
+
$motion-ui-classes: (
|
7
|
+
chain: true,
|
8
|
+
prefix: 'mui-',
|
9
|
+
active: '-active',
|
10
|
+
) !default;
|
11
|
+
|
12
|
+
/// State names to reference when writing motion classes. To use multiple class names for one state, enter a list of strings instead of one string.
|
13
|
+
/// @type Map
|
14
|
+
$motion-ui-states: (
|
15
|
+
in: 'enter',
|
16
|
+
out: 'leave',
|
17
|
+
) !default;
|
18
|
+
|
19
|
+
/// Default speed that transitions and animations play at, along with values for modifier classes to change the speed.
|
20
|
+
/// @type Map
|
21
|
+
$motion-ui-speeds: (
|
22
|
+
default: 500ms,
|
23
|
+
slow: 750ms,
|
24
|
+
fast: 250ms,
|
25
|
+
) !default;
|
26
|
+
|
27
|
+
/// Default delay to add before motion, along with values for modifier classes to change the delay.
|
28
|
+
/// @type Map
|
29
|
+
$motion-ui-delays: (
|
30
|
+
default: 0,
|
31
|
+
short: 300ms,
|
32
|
+
long: 700ms,
|
33
|
+
) !default;
|
34
|
+
|
35
|
+
/// Default easing for transitions and animations, along with values for modifier classes to change the easing.
|
36
|
+
/// @type Map
|
37
|
+
$motion-ui-easings: (
|
38
|
+
default: linear,
|
39
|
+
linear: linear,
|
40
|
+
ease: ease,
|
41
|
+
ease-in: ease-in,
|
42
|
+
ease-out: ease-out,
|
43
|
+
ease-in-out: ease-in-out,
|
44
|
+
bounce-in: cubic-bezier(0.485, 0.155, 0.24, 1.245),
|
45
|
+
bounce-out: cubic-bezier(0.485, 0.155, 0.515, 0.845),
|
46
|
+
bounce-in-out: cubic-bezier(0.76, -0.245, 0.24, 1.245),
|
47
|
+
) !default;
|
48
|
+
|
49
|
+
/// Miscellaneous settings related to Motion UI.
|
50
|
+
/// @type Map
|
51
|
+
/// @prop {Boolean} slide-and-fade [false] - Defines if slide motions should also fade in/out.
|
52
|
+
/// @prop {Boolean} slide-and-fade [true] - Defines if hinge motions should also fade in/out.
|
53
|
+
/// @prop {Boolean} slide-and-fade [true] - Defines if scale motions should also fade in/out.
|
54
|
+
/// @prop {Boolean} slide-and-fade [true] - Defines if spin motions should also fade in/out.
|
55
|
+
$motion-ui-settings: (
|
56
|
+
slide-and-fade: false,
|
57
|
+
hinge-and-fade: true,
|
58
|
+
scale-and-fade: true,
|
59
|
+
spin-and-fade: true,
|
60
|
+
activate-queue-class: 'is-animating',
|
61
|
+
) !default;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/// Creates a fading animation.
|
2
|
+
/// @param {Number} $from [0] - Opacity to start at.
|
3
|
+
/// @param {Number} $to [1] - Opacity to end at.
|
4
|
+
/// @return {Map} A keyframes map that can be used with the `generate-keyframes()` mixin.
|
5
|
+
@function fade(
|
6
|
+
$from: 0,
|
7
|
+
$to: 1
|
8
|
+
) {
|
9
|
+
$type: type-of($from);
|
10
|
+
$keyframes: ();
|
11
|
+
|
12
|
+
@if $type == 'string' {
|
13
|
+
@if $from == in {
|
14
|
+
$from: 0;
|
15
|
+
$to: 1;
|
16
|
+
} @else if $from == out {
|
17
|
+
$from: 1;
|
18
|
+
$to: 0;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
$keyframes: (
|
23
|
+
name: 'fade-#{$from}-to-#{$to}',
|
24
|
+
0: (opacity: $from),
|
25
|
+
100: (opacity: $to),
|
26
|
+
);
|
27
|
+
|
28
|
+
@return $keyframes;
|
29
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/// Creates a hinge effect by rotating the element.
|
2
|
+
/// @param {Keyword} $state [in] - State to transition to.
|
3
|
+
/// @param {Keyword} $from [left] - Edge of the element to rotate from. Can be `top`, `right`, `bottom`, or `left`.
|
4
|
+
/// @param {Keyword} $axis [edge] - Axis of the element to rotate on. Can be `edge` or `center`.
|
5
|
+
/// @param {Number} $perspective [2000px] - Perceived distance between the viewer and the element. A higher number will make the rotation effect more pronounced.
|
6
|
+
/// @param {Keyword} $turn-origin [from-back] - Side of the element to start the rotation from. Can be `from-back` or `from-front`.
|
7
|
+
@function hinge (
|
8
|
+
$state: in,
|
9
|
+
$from: left,
|
10
|
+
$axis: edge,
|
11
|
+
$perspective: 2000px,
|
12
|
+
$turn-origin: from-back
|
13
|
+
) {
|
14
|
+
// Rotation directions when hinging from back vs. front
|
15
|
+
$rotation-amount: 90deg;
|
16
|
+
$rotations-back: (
|
17
|
+
top: rotateX($rotation-amount * -1),
|
18
|
+
right: rotateY($rotation-amount * -1),
|
19
|
+
bottom: rotateX($rotation-amount),
|
20
|
+
left: rotateY($rotation-amount),
|
21
|
+
);
|
22
|
+
$rotations-from: (
|
23
|
+
top: rotateX($rotation-amount),
|
24
|
+
right: rotateY($rotation-amount),
|
25
|
+
bottom: rotateX($rotation-amount * -1),
|
26
|
+
left: rotateY($rotation-amount * -1),
|
27
|
+
);
|
28
|
+
|
29
|
+
// Rotation origin
|
30
|
+
$rotation: '';
|
31
|
+
@if $turn-origin == from-front {
|
32
|
+
$rotation: map-get($rotations-from, $from);
|
33
|
+
} @else if $turn-origin == from-back {
|
34
|
+
$rotation: map-get($rotations-back, $from);
|
35
|
+
} @else {
|
36
|
+
@warn '$turn-origin must be either "from-back" or "from-front"';
|
37
|
+
}
|
38
|
+
|
39
|
+
// Start and end state
|
40
|
+
$start: '';
|
41
|
+
$end: '';
|
42
|
+
@if $state == in {
|
43
|
+
$start: perspective($perspective) $rotation;
|
44
|
+
$end: perspective($perspective) rotate(0deg);
|
45
|
+
} @else {
|
46
|
+
$start: perspective($perspective) rotate(0deg);
|
47
|
+
$end: perspective($perspective) $rotation;
|
48
|
+
}
|
49
|
+
|
50
|
+
// Turn axis
|
51
|
+
$origin: '';
|
52
|
+
@if $axis == edge {
|
53
|
+
$origin: $from;
|
54
|
+
} @else {
|
55
|
+
$origin: center;
|
56
|
+
}
|
57
|
+
|
58
|
+
$keyframes: (
|
59
|
+
name: 'hinge-#{$state}-#{$from}-#{$axis}-#{$turn-origin}',
|
60
|
+
0: (transform: $start, transform-origin: $origin),
|
61
|
+
100: (transform: $end),
|
62
|
+
);
|
63
|
+
|
64
|
+
@return $keyframes;
|
65
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/// Creates a shaking animation.
|
2
|
+
/// @param {Percentage} $intensity [7%] - Intensity of the shake, as a percentage value.
|
3
|
+
/// @return {Map} A keyframes map that can be used with the `generate-keyframes()` mixin.
|
4
|
+
@function shake($intensity: 7%) {
|
5
|
+
$right: (0, 10, 20, 30, 40, 50, 60, 70, 80, 90);
|
6
|
+
$left: (5, 15, 25, 35, 45, 55, 65, 75, 85, 95);
|
7
|
+
|
8
|
+
$keyframes: (
|
9
|
+
name: 'shake-#{($intensity / 1%)}',
|
10
|
+
$right: (transform: translateX($intensity)),
|
11
|
+
$left: (transform: translateX(-$intensity)),
|
12
|
+
);
|
13
|
+
|
14
|
+
@return $keyframes;
|
15
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/// Creates a sliding animation.
|
2
|
+
/// @param {Keyword} $state [in] - Whether to move to (`in`) or from (`out`) the element's default position.
|
3
|
+
/// @param {Keyword} $direction [up] - Direction to move. Can be `up`, `down`, `left`, or `right`.
|
4
|
+
/// @param {Number} $amount [100%] - Distance to move. Can be any CSS length unit.
|
5
|
+
/// @return {Map} A keyframes map that can be used with the `generate-keyframes()` mixin.
|
6
|
+
@function slide(
|
7
|
+
$state: in,
|
8
|
+
$direction: up,
|
9
|
+
$amount: 100%
|
10
|
+
) {
|
11
|
+
$from: $amount;
|
12
|
+
$to: 0;
|
13
|
+
$func: 'translateY';
|
14
|
+
|
15
|
+
@if $direction == left or $direction == right {
|
16
|
+
$func: 'translateX';
|
17
|
+
}
|
18
|
+
|
19
|
+
@if $state == out {
|
20
|
+
$from: 0;
|
21
|
+
$to: $amount;
|
22
|
+
}
|
23
|
+
|
24
|
+
@if $direction == down or $direction == right {
|
25
|
+
@if $state == in {
|
26
|
+
$from: -$from;
|
27
|
+
}
|
28
|
+
} @else {
|
29
|
+
@if $state == out {
|
30
|
+
$to: -$to;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
$keyframes: (
|
35
|
+
name: 'slide-#{$state}-#{$direction}-#{strip-unit($amount)}',
|
36
|
+
0: (transform: '#{$func}(#{$from})'),
|
37
|
+
100: (transform: '#{$func}(#{$to})'),
|
38
|
+
);
|
39
|
+
|
40
|
+
@return $keyframes;
|
41
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/// Creates a spinning animation.
|
2
|
+
/// @param {Keyword} $direction [cw] - Direction to spin. Should be `cw` (clockwise) or `ccw` (counterclockwise).
|
3
|
+
/// @param {Number} $amount [360deg] - Amount to spin. Can be any CSS angle unit.
|
4
|
+
/// @return {Map} A keyframes map that can be used with the `generate-keyframes()` mixin.
|
5
|
+
@function spin(
|
6
|
+
$state: in,
|
7
|
+
$direction: cw,
|
8
|
+
$amount: 1turn
|
9
|
+
) {
|
10
|
+
$start: 0;
|
11
|
+
$end: 0;
|
12
|
+
|
13
|
+
@if $state == in {
|
14
|
+
$start: if($direction == ccw, $amount, $amount * -1);
|
15
|
+
$end: 0;
|
16
|
+
} @else {
|
17
|
+
$start: 0;
|
18
|
+
$end: if($direction == ccw, $amount * -1, $amount);
|
19
|
+
}
|
20
|
+
|
21
|
+
$keyframes: (
|
22
|
+
name: 'spin-#{$direction}-#{$amount}',
|
23
|
+
0: (transform: rotate($start)),
|
24
|
+
100: (transform: rotate($end)),
|
25
|
+
);
|
26
|
+
|
27
|
+
@return $keyframes;
|
28
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/// Creates a wiggling animation.
|
2
|
+
/// @param {Number} $intensity [7deg] - Intensity of the wiggle. Can be any CSS angle unit.
|
3
|
+
/// @return {Map} A keyframes map that can be used with the `generate-keyframes()` mixin.
|
4
|
+
@function wiggle($intensity: 7deg) {
|
5
|
+
$keyframes: (
|
6
|
+
name: 'wiggle-#{$intensity}',
|
7
|
+
(40, 50, 60): (transform: rotate($intensity)),
|
8
|
+
(35, 45, 55, 65): (transform: rotate(-$intensity)),
|
9
|
+
(0, 30, 70, 100): (transform: rotate(0)),
|
10
|
+
);
|
11
|
+
|
12
|
+
@return $keyframes;
|
13
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/// Creates a scaling transition. A scale of `1` means the element is the same size. Larger numbers make the element bigger, while numbers less than 1 make the element smaller.
|
2
|
+
/// @param {Number} $from [1.5] - Size to start at.
|
3
|
+
/// @param {Number} $from [1] - Size to end at.
|
4
|
+
@function zoom(
|
5
|
+
$from: 0,
|
6
|
+
$to: 1
|
7
|
+
) {
|
8
|
+
$keyframes: (
|
9
|
+
name: 'scale-#{$to}-to-#{$from}',
|
10
|
+
0: (transform: scale($from)),
|
11
|
+
100: (transform: scale($to)),
|
12
|
+
);
|
13
|
+
|
14
|
+
@return $keyframes;
|
15
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// Motion UI by ZURB
|
2
|
+
// foundation.zurb.com/motion-ui
|
3
|
+
// Licensed under MIT Open Source
|
4
|
+
|
5
|
+
@import 'settings';
|
6
|
+
|
7
|
+
@import 'util/animation';
|
8
|
+
@import 'util/args';
|
9
|
+
@import 'util/keyframe';
|
10
|
+
@import 'util/selector';
|
11
|
+
@import 'util/series';
|
12
|
+
@import 'util/transition';
|
13
|
+
@import 'util/unit';
|
14
|
+
|
15
|
+
@import 'effects/fade';
|
16
|
+
@import 'effects/hinge';
|
17
|
+
@import 'effects/spin';
|
18
|
+
@import 'effects/zoom';
|
19
|
+
@import 'effects/shake';
|
20
|
+
@import 'effects/slide';
|
21
|
+
@import 'effects/wiggle';
|
22
|
+
|
23
|
+
@import 'transitions/fade';
|
24
|
+
@import 'transitions/hinge';
|
25
|
+
@import 'transitions/zoom';
|
26
|
+
@import 'transitions/slide';
|
27
|
+
@import 'transitions/spin';
|
28
|
+
|
29
|
+
@import 'classes';
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/// Creates a fade transition by adjusting the opacity of the element.
|
2
|
+
/// @param {Keyword} $state [in] - State to transition to.
|
3
|
+
/// @param {Number} $from [0] - Opacity to start at. Must be a number between 0 and 1.
|
4
|
+
/// @param {Number} $to [1] - Opacity to end on.
|
5
|
+
/// @param {Keyword} $duration [null] - Length (speed) of the transition.
|
6
|
+
/// @param {Keyword|Function} $timing [null] - Easing of the transition.
|
7
|
+
/// @param {Duration} $delay [null] - Delay in seconds or milliseconds before the transition starts.
|
8
|
+
@mixin mui-fade(
|
9
|
+
$state: in,
|
10
|
+
$from: 0,
|
11
|
+
$to: 1,
|
12
|
+
$duration: null,
|
13
|
+
$timing: null,
|
14
|
+
$delay: null
|
15
|
+
) {
|
16
|
+
$fade: fade($from, $to);
|
17
|
+
|
18
|
+
@include transition-start($state) {
|
19
|
+
@include transition-basics($duration, $timing, $delay);
|
20
|
+
@include -mui-keyframe-get($fade, 0);
|
21
|
+
|
22
|
+
transition-property: opacity;
|
23
|
+
}
|
24
|
+
|
25
|
+
@include transition-end($state) {
|
26
|
+
@include -mui-keyframe-get($fade, 100);
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/// Creates a hinge transition by rotating the element.
|
2
|
+
/// @param {Keyword} $state [in] - State to transition to.
|
3
|
+
/// @param {Keyword} $from [left] - Edge of the element to rotate from. Can be `top`, `right`, `bottom`, or `left`.
|
4
|
+
/// @param {Keyword} $axis [edge] - Axis of the element to rotate on. Can be `edge` or `center`.
|
5
|
+
/// @param {Length} $perspective [2000px] - Perceived distance between the viewer and the element. A higher number will make the rotation effect more pronounced.
|
6
|
+
/// @param {Keyword} $turn-origin [from-back] - Side of the element to start the rotation from. Can be `from-back` or `from-front`.
|
7
|
+
/// @param {Boolean} $fade [true] - Set to `true` to fade the element in or out simultaneously.
|
8
|
+
/// @param {Duration} $duration [null] - Length (speed) of the transition.
|
9
|
+
/// @param {Keyword|Function} $timing [null] - Easing of the transition.
|
10
|
+
/// @param {Duration} $delay [null] - Delay in seconds or milliseconds before the transition starts.
|
11
|
+
@mixin mui-hinge (
|
12
|
+
$state: in,
|
13
|
+
$from: left,
|
14
|
+
$axis: edge,
|
15
|
+
$perspective: 2000px,
|
16
|
+
$turn-origin: from-back,
|
17
|
+
$fade: map-get($motion-ui-settings, hinge-and-fade),
|
18
|
+
$duration: null,
|
19
|
+
$timing: null,
|
20
|
+
$delay: null
|
21
|
+
) {
|
22
|
+
$hinge: hinge($state, $from, $axis, $perspective, $turn-origin);
|
23
|
+
|
24
|
+
@include transition-start($state) {
|
25
|
+
@include transition-basics($duration, $timing, $delay);
|
26
|
+
@include -mui-keyframe-get($hinge, 0);
|
27
|
+
|
28
|
+
@if $fade {
|
29
|
+
transition-property: transform, opacity;
|
30
|
+
opacity: if($state == in, 0, 1);
|
31
|
+
} @else {
|
32
|
+
transition-property: transform, opacity;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
@include transition-end($state) {
|
37
|
+
@include -mui-keyframe-get($hinge, 100);
|
38
|
+
|
39
|
+
@if $fade {
|
40
|
+
opacity: if($state == in, 1, 0);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/// Creates a sliding transition by translating the element horizontally or vertically.
|
2
|
+
/// @param {Keyword} $state [in] - State to transition to.
|
3
|
+
/// @param {Keyword} $direction [left] - Side of the element to slide from. Can be `top`, `right`, `bottom`, or `left`.
|
4
|
+
/// @param {Length} $amount [100%] - Length of the slide as a percentage value.
|
5
|
+
/// @param {Boolean} $fade [false] - Set to `true` to fade the element in or out simultaneously.
|
6
|
+
/// @param {Duration} $duration [null] - Length (speed) of the transition.
|
7
|
+
/// @param {Keyword|Function} $timing [null] - Easing of the transition.
|
8
|
+
/// @param {Duration} $delay [null] - Delay in seconds or milliseconds before the transition starts.
|
9
|
+
@mixin mui-slide (
|
10
|
+
$state: in,
|
11
|
+
$direction: left,
|
12
|
+
$amount: 100%,
|
13
|
+
$fade: map-get($motion-ui-settings, slide-and-fade),
|
14
|
+
$duration: null,
|
15
|
+
$timing: null,
|
16
|
+
$delay: null
|
17
|
+
) {
|
18
|
+
$slide: slide($state, $direction, $amount);
|
19
|
+
|
20
|
+
// CSS Output
|
21
|
+
@include transition-start($state) {
|
22
|
+
@include transition-basics($duration, $timing, $delay);
|
23
|
+
@include -mui-keyframe-get($slide, 0);
|
24
|
+
|
25
|
+
@if $fade {
|
26
|
+
transition-property: transform, opacity;
|
27
|
+
opacity: if($state == in, 0, 1);
|
28
|
+
} @else {
|
29
|
+
transition-property: transform, opacity;
|
30
|
+
}
|
31
|
+
|
32
|
+
backface-visibility: hidden;
|
33
|
+
}
|
34
|
+
|
35
|
+
@include transition-end($state) {
|
36
|
+
@include -mui-keyframe-get($slide, 100);
|
37
|
+
|
38
|
+
@if $fade {
|
39
|
+
opacity: if($state == in, 1, 0);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/// Creates a spinning transition by rotating the element. The `turn` unit is used to specify how far to rotate. `1turn` is equal to a 360-degree spin.
|
2
|
+
/// @param {Keyword} $state [in] - State to transition to.
|
3
|
+
/// @param {Boolean} $direction [cw] - Direction to spin. Should be `cw` (clockwise) or `ccw` (counterclockwise).
|
4
|
+
/// @param {Number} $amount [0.75turn] - Amount to element the element.
|
5
|
+
/// @param {Boolean} $fade [false] - Set to `true` to fade the element in or out simultaneously.
|
6
|
+
/// @param {Duration} $duration [null] - Length (speed) of the transition.
|
7
|
+
/// @param {Keyword|Function} $timing [null] - Easing of the transition.
|
8
|
+
/// @param {Duration} $delay [null] - Delay in seconds or milliseconds before the transition starts.
|
9
|
+
@mixin mui-spin(
|
10
|
+
$state: in,
|
11
|
+
$direction: cw,
|
12
|
+
$amount: 0.75turn,
|
13
|
+
$fade: map-get($motion-ui-settings, spin-and-fade),
|
14
|
+
$duration: null,
|
15
|
+
$timing: null,
|
16
|
+
$delay: null
|
17
|
+
) {
|
18
|
+
$spin: spin($state, $direction, $amount);
|
19
|
+
|
20
|
+
@include transition-start($state) {
|
21
|
+
@include transition-basics($duration, $timing, $delay);
|
22
|
+
@include -mui-keyframe-get($spin, 0);
|
23
|
+
|
24
|
+
@if $fade {
|
25
|
+
transition-property: transform, opacity;
|
26
|
+
opacity: if($state == in, 0, 1);
|
27
|
+
} @else {
|
28
|
+
transition-property: transform, opacity;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
@include transition-end($state) {
|
33
|
+
@include -mui-keyframe-get($spin, 100);
|
34
|
+
|
35
|
+
@if $fade {
|
36
|
+
opacity: if($state == in, 1, 0);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/// Creates a scaling transition. A scale of `1` means the element is the same size. Larger numbers make the element bigger, while numbers less than 1 make the element smaller.
|
2
|
+
/// @param {Keyword} $state [in] - State to transition to.
|
3
|
+
/// @param {Number} $from [1.5] - Size to start at.
|
4
|
+
/// @param {Number} $from [1] - Size to end at.
|
5
|
+
/// @param {Boolean} $fade [true] - Set to `true` to fade the element in or out simultaneously.
|
6
|
+
/// @param {Duration} $duration [null] - Length (speed) of the transition.
|
7
|
+
/// @param {Keyword|Function} $timing [null] - Easing of the transition.
|
8
|
+
/// @param {Duration} $delay [null] - Delay in seconds or milliseconds before the transition starts.
|
9
|
+
@mixin mui-zoom(
|
10
|
+
$state: in,
|
11
|
+
$from: 1.5,
|
12
|
+
$to: 1,
|
13
|
+
$fade: map-get($motion-ui-settings, scale-and-fade),
|
14
|
+
$duration: null,
|
15
|
+
$timing: null,
|
16
|
+
$delay: null
|
17
|
+
) {
|
18
|
+
$scale: zoom($from, $to);
|
19
|
+
|
20
|
+
@include transition-start($state) {
|
21
|
+
@include transition-basics($duration, $timing, $delay);
|
22
|
+
@include -mui-keyframe-get($scale, 0);
|
23
|
+
|
24
|
+
@if $fade {
|
25
|
+
transition-property: transform, opacity;
|
26
|
+
opacity: if($state == in, 0, 1);
|
27
|
+
} @else {
|
28
|
+
transition-property: transform, opacity;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
@include transition-end($state) {
|
33
|
+
@include -mui-keyframe-get($scale, 100);
|
34
|
+
|
35
|
+
@if $fade {
|
36
|
+
opacity: if($state == in, 1, 0);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/// Creates a keyframe from one or more effect functions and assigns it to the element by adding the `animation-name` property.
|
2
|
+
/// @param {Function} $effects... - One or more effect functions to build the keyframe with.
|
3
|
+
@mixin mui-animation($args...) {
|
4
|
+
$name: map-get(-mui-process-args($args...), name);
|
5
|
+
@include mui-keyframes($name, $args...);
|
6
|
+
animation-name: unquote($name);
|
7
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/// Processes a series of keyframe function arguments.
|
2
|
+
/// @access private
|
3
|
+
@function -mui-process-args($args...) {
|
4
|
+
@if length($args) == 1 {
|
5
|
+
$arg: nth($args, 1);
|
6
|
+
|
7
|
+
@if type-of($arg) == 'string' {
|
8
|
+
@return call($arg);
|
9
|
+
} @else if type-of($arg) == 'map' {
|
10
|
+
@return $arg;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
@return -mui-keyframe-combine($args...);
|
15
|
+
}
|
@@ -0,0 +1,136 @@
|
|
1
|
+
// Internal counter for creating unique keyframe names
|
2
|
+
$-mui-custom: 0;
|
3
|
+
|
4
|
+
/// Creates a keyframe from one or more effect functions. Use this function instead of `mui-animation` if you want to create a keyframe animation *without* automatically assigning it to the element.
|
5
|
+
/// @param {String} $name - Name of the keyframe.
|
6
|
+
/// @param {Function} $effects... - One or more effect functions to build the keyframe with.
|
7
|
+
@mixin mui-keyframes($name, $effects...) {
|
8
|
+
$obj: -mui-process-args($effects...);
|
9
|
+
$obj: map-remove($obj, name);
|
10
|
+
|
11
|
+
@keyframes #{$name} {
|
12
|
+
// Now iterate through each keyframe percentage
|
13
|
+
@each $pct, $props in $obj {
|
14
|
+
#{-mui-keyframe-pct($pct)} {
|
15
|
+
// Lastly, iterate through each CSS property within a percentage and print it out
|
16
|
+
@each $prop, $value in $props {
|
17
|
+
#{$prop}: #{$value};
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
/// Creates a string for a CSS keyframe, by converting a list of numbers to a comma-separated list of percentage values.
|
25
|
+
/// @param {Number|List} $input - List of numbers to use.
|
26
|
+
/// @return {String} A set of comma-separated percentage values.
|
27
|
+
/// @access private
|
28
|
+
@function -mui-keyframe-pct($input) {
|
29
|
+
$output: ();
|
30
|
+
|
31
|
+
@if type-of($input) == 'number' {
|
32
|
+
$output: ($input * 1%);
|
33
|
+
} @else if type-of($input) == 'list' {
|
34
|
+
@each $i in $input {
|
35
|
+
$output: append($output, ($i * 1%), comma);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
@return $output;
|
40
|
+
}
|
41
|
+
|
42
|
+
/// Prints the CSS properties from a specific key in a keyframes map. Used to borrow CSS from keyframe functions for use in transitions.
|
43
|
+
/// @param {Map} $kf - Keyframe map to extract from.
|
44
|
+
/// @param {Number} $key - Key in the map to print the CSS of.
|
45
|
+
/// @access private
|
46
|
+
@mixin -mui-keyframe-get($kf, $key) {
|
47
|
+
$map: map-get($kf, $key);
|
48
|
+
|
49
|
+
@each $prop, $value in $map or () {
|
50
|
+
// Some keyframe maps store transforms as quoted strings
|
51
|
+
@if type-of($value) == 'string' {
|
52
|
+
$value: unquote($value);
|
53
|
+
}
|
54
|
+
#{$prop}: $value;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
/// Reformats a map containing keys with a list of values, so that each key is a single value.
|
59
|
+
/// @param {Map} $map - Map to split up.
|
60
|
+
/// @return {Map} A reformatted map.
|
61
|
+
/// @access private
|
62
|
+
@function -mui-keyframe-split($map) {
|
63
|
+
$new-map: ();
|
64
|
+
|
65
|
+
// Split keys with multiple values into individual keys
|
66
|
+
@each $key, $item in $map {
|
67
|
+
$key-type: type-of($key);
|
68
|
+
|
69
|
+
@if $key-type == 'number' {
|
70
|
+
$new-map: map-merge($new-map, ($key: $item));
|
71
|
+
} @else if $key-type == 'list' {
|
72
|
+
@each $k in $key {
|
73
|
+
$new-map: map-merge($new-map, ($k: $item));
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
@return $new-map;
|
79
|
+
}
|
80
|
+
|
81
|
+
/// Combines a series of keyframe objects into one.
|
82
|
+
/// @param {Map} $maps... - A series of maps to merge, as individual parameters.
|
83
|
+
/// @return {Map} A combined keyframe object.
|
84
|
+
/// @access private
|
85
|
+
@function -mui-keyframe-combine($maps...) {
|
86
|
+
$new-map: ();
|
87
|
+
|
88
|
+
// Iterate through each map passed in
|
89
|
+
@each $map in $maps {
|
90
|
+
@if type-of($map) == 'string' {
|
91
|
+
$map: call($map);
|
92
|
+
}
|
93
|
+
|
94
|
+
$map: -mui-keyframe-split($map);
|
95
|
+
|
96
|
+
// Iterate through each keyframe in the map
|
97
|
+
// $key is the keyframe percentage
|
98
|
+
// $value is a map of CSS properties
|
99
|
+
@each $key, $value in $map {
|
100
|
+
$new-value: ();
|
101
|
+
|
102
|
+
@if map-has-key($new-map, $key) {
|
103
|
+
// If the map already has the keyframe %, append the new property
|
104
|
+
$new-value: -mui-merge-properties(map-get($new-map, $key), $value);
|
105
|
+
} @else {
|
106
|
+
// Otherwise, create a new map with the new property
|
107
|
+
$new-value: $value;
|
108
|
+
}
|
109
|
+
|
110
|
+
// Finally, merge the modified keyframe value into the output map
|
111
|
+
$new-map: map-merge($new-map, ($key: $new-value));
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
// Make a name for the keyframes
|
116
|
+
$-mui-custom: $-mui-custom + 1 !global;
|
117
|
+
$map-name: (name: 'custom-#{$-mui-custom}');
|
118
|
+
$new-map: map-merge($new-map, $map-name);
|
119
|
+
|
120
|
+
@return $new-map;
|
121
|
+
}
|
122
|
+
|
123
|
+
/// Combines two maps of CSS properties into one map. If both maps have a transform property, the values from each will be combined into one property.
|
124
|
+
/// @param {Map} $one - First map to merge.
|
125
|
+
/// @param {Map} $two - Second map to merge.
|
126
|
+
/// @return {Map} A combined map.
|
127
|
+
/// @access private
|
128
|
+
@function -mui-merge-properties($one, $two) {
|
129
|
+
@if map-has-key($one, transform) and map-has-key($two, transform) {
|
130
|
+
$transform: join(map-get($one, transform), map-get($two, transform));
|
131
|
+
$one: map-merge($one, (transform: $transform));
|
132
|
+
$two: map-remove($two, transform);
|
133
|
+
}
|
134
|
+
|
135
|
+
@return map-merge($one, $two);
|
136
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/// Builds a selector for a motion class, using the settings defined in the `$motion-ui-classes` and `$motion-ui-states` maps.
|
2
|
+
/// @param {String|List} $states - One or more strings that correlate to a state.
|
3
|
+
/// @param {Boolean} $active - Defines if the selector is for the setup or active class.
|
4
|
+
/// @return {String} A selector that can be interpolated into your Sass code.
|
5
|
+
/// @access private
|
6
|
+
@function -mui-build-selector($states, $active: false) {
|
7
|
+
$return: '';
|
8
|
+
$chain: map-get($motion-ui-classes, chain);
|
9
|
+
$prefix: map-get($motion-ui-classes, prefix);
|
10
|
+
$suffix: map-get($motion-ui-classes, active);
|
11
|
+
|
12
|
+
@each $sel in $states {
|
13
|
+
$return: $return + if($chain, '&.', '#{&}-') + $prefix + $sel;
|
14
|
+
|
15
|
+
@if $active {
|
16
|
+
$return: $return + if($chain, '.', '#{&}-') + $prefix + $sel + $suffix;
|
17
|
+
}
|
18
|
+
|
19
|
+
$return: $return + ', ';
|
20
|
+
}
|
21
|
+
|
22
|
+
@return str-slice($return, 1, -3);
|
23
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
$-mui-queue: ();
|
2
|
+
|
3
|
+
/// Pauses the animation on an element by default, and then plays it when an active class is added to a parent. Also sets the fill mode of the animation to `both`. This pauses the element at the first frame of the animation, and holds it in place at the end.
|
4
|
+
/// @access private
|
5
|
+
%animated-element {
|
6
|
+
animation-play-state: paused;
|
7
|
+
animation-fill-mode: both;
|
8
|
+
|
9
|
+
.#{map-get($motion-ui-settings, activate-queue-class)} & {
|
10
|
+
animation-play-state: running;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
/// Creates a new animation queue.
|
15
|
+
/// @param {Duration} $delay [0s] - Delay in seconds or milliseconds to place at the front of the animation queue.
|
16
|
+
@mixin mui-series($delay: 0s) {
|
17
|
+
$-mui-queue: () !global;
|
18
|
+
|
19
|
+
@if $delay > 0 {
|
20
|
+
$item: ($delay, 0s);
|
21
|
+
$-mui-queue: append($-mui-queue, $item) !global;
|
22
|
+
}
|
23
|
+
|
24
|
+
@content;
|
25
|
+
}
|
26
|
+
|
27
|
+
/// Adds an animation to an animation queue. Only use this mixin inside of `mui-series()`.
|
28
|
+
/// @param {Duration} $duration [1s] - Length of the animation.
|
29
|
+
/// @param {Duration} $gap [0s] - Amount of time to pause before playing the animation after this one. Use a negative value to make the next effect overlap with the current one.
|
30
|
+
/// @param {Function} $keyframes... - One or more effect functions to build the keyframe with.
|
31
|
+
@mixin mui-queue(
|
32
|
+
$duration: 1s,
|
33
|
+
$gap: 0s,
|
34
|
+
$keyframes...
|
35
|
+
) {
|
36
|
+
// Build the animation
|
37
|
+
$kf: -mui-process-args($keyframes...);
|
38
|
+
|
39
|
+
// Calculate the delay for this animation based on how long the previous ones take
|
40
|
+
$actual-delay: 0s;
|
41
|
+
@each $anim in $-mui-queue {
|
42
|
+
$actual-delay: $actual-delay + nth($anim, 1) + nth($anim, 2);
|
43
|
+
}
|
44
|
+
|
45
|
+
// Append this animation's length and gap to the end of the queue
|
46
|
+
$item: ($duration, $gap);
|
47
|
+
$-mui-queue: append($-mui-queue, $item) !global;
|
48
|
+
|
49
|
+
// CSS output
|
50
|
+
@extend %animated-element;
|
51
|
+
@include mui-animation($kf);
|
52
|
+
animation-duration: $duration;
|
53
|
+
animation-delay: $actual-delay;
|
54
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/// Applies basic transition settings to an element.
|
2
|
+
/// @param {Duration} $duration [null] - Length (speed) of the transition.
|
3
|
+
/// @param {Keyword|Function} $timing [null] - Easing of the transition.
|
4
|
+
/// @param {Duration} $delay [null] - Delay in seconds or milliseconds before the transition starts.
|
5
|
+
@mixin transition-basics(
|
6
|
+
$duration: null,
|
7
|
+
$timing: null,
|
8
|
+
$delay: null
|
9
|
+
) {
|
10
|
+
@extend %mui-defaults;
|
11
|
+
transition-duration: $duration;
|
12
|
+
transition-timing-function: $timing;
|
13
|
+
transition-delay: $delay;
|
14
|
+
}
|
15
|
+
|
16
|
+
/// Wraps the content in the setup class for a transition.
|
17
|
+
/// @param {Keyword} $dir - State to setup for transition.
|
18
|
+
@mixin transition-start($dir) {
|
19
|
+
$selector: -mui-build-selector(map-get($motion-ui-states, $dir));
|
20
|
+
|
21
|
+
@at-root {
|
22
|
+
#{$selector} {
|
23
|
+
@content;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
/// Wraps the content in the active class for a transition.
|
29
|
+
/// @param {Keyword} $dir - State to activate a transition on.
|
30
|
+
@mixin transition-end($dir) {
|
31
|
+
$selector: -mui-build-selector(map-get($motion-ui-states, $dir), true);
|
32
|
+
|
33
|
+
@at-root {
|
34
|
+
#{$selector} {
|
35
|
+
@content;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
/// Adds styles for a stagger animation, which can be used with Angular's `ng-repeat`.
|
41
|
+
/// @param {Duration} $delay-amount - Amount of time in seconds or milliseconds to add between each item's animation.
|
42
|
+
@mixin stagger($delay-amount) {
|
43
|
+
transition-delay: $delay-amount;
|
44
|
+
transition-duration: 0; // Prevent accidental CSS inheritance
|
45
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/// Removes the unit (e.g. px, em, rem) from a value, returning the number only.
|
2
|
+
/// @param {Number} $num - Number to strip unit from.
|
3
|
+
/// @return {Number} The same number, sans unit.
|
4
|
+
/// @access private
|
5
|
+
@function strip-unit($num) {
|
6
|
+
@return $num / ($num * 0 + 1);
|
7
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foundation-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.1.
|
4
|
+
version: 6.1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ZURB
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -226,6 +226,28 @@ files:
|
|
226
226
|
- vendor/assets/scss/grid/_position.scss
|
227
227
|
- vendor/assets/scss/grid/_row.scss
|
228
228
|
- vendor/assets/scss/grid/_size.scss
|
229
|
+
- vendor/assets/scss/motion-ui/_classes.scss
|
230
|
+
- vendor/assets/scss/motion-ui/_settings.scss
|
231
|
+
- vendor/assets/scss/motion-ui/effects/_fade.scss
|
232
|
+
- vendor/assets/scss/motion-ui/effects/_hinge.scss
|
233
|
+
- vendor/assets/scss/motion-ui/effects/_shake.scss
|
234
|
+
- vendor/assets/scss/motion-ui/effects/_slide.scss
|
235
|
+
- vendor/assets/scss/motion-ui/effects/_spin.scss
|
236
|
+
- vendor/assets/scss/motion-ui/effects/_wiggle.scss
|
237
|
+
- vendor/assets/scss/motion-ui/effects/_zoom.scss
|
238
|
+
- vendor/assets/scss/motion-ui/motion-ui.scss
|
239
|
+
- vendor/assets/scss/motion-ui/transitions/_fade.scss
|
240
|
+
- vendor/assets/scss/motion-ui/transitions/_hinge.scss
|
241
|
+
- vendor/assets/scss/motion-ui/transitions/_slide.scss
|
242
|
+
- vendor/assets/scss/motion-ui/transitions/_spin.scss
|
243
|
+
- vendor/assets/scss/motion-ui/transitions/_zoom.scss
|
244
|
+
- vendor/assets/scss/motion-ui/util/_animation.scss
|
245
|
+
- vendor/assets/scss/motion-ui/util/_args.scss
|
246
|
+
- vendor/assets/scss/motion-ui/util/_keyframe.scss
|
247
|
+
- vendor/assets/scss/motion-ui/util/_selector.scss
|
248
|
+
- vendor/assets/scss/motion-ui/util/_series.scss
|
249
|
+
- vendor/assets/scss/motion-ui/util/_transition.scss
|
250
|
+
- vendor/assets/scss/motion-ui/util/_unit.scss
|
229
251
|
- vendor/assets/scss/settings/_settings.scss
|
230
252
|
- vendor/assets/scss/typography/_alignment.scss
|
231
253
|
- vendor/assets/scss/typography/_base.scss
|