| 1 |
// Shorthand mixin. Supports multiple parentheses-deliminated values for each variable. |
| 2 |
// Example: @include transition (all 2s ease-in-out); |
| 3 |
// @include transition (opacity 1s ease-in 2s, width 2s ease-out); |
| 4 |
// @include transition-property (transform, opacity); |
| 5 |
|
| 6 |
@mixin transition($properties...) { |
| 7 |
@include _bourbon-deprecate-for-prefixing("transition"); |
| 8 |
|
| 9 |
// Fix for vendor-prefix transform property |
| 10 |
$needs-prefixes: false; |
| 11 |
$webkit: (); |
| 12 |
$moz: (); |
| 13 |
$spec: (); |
| 14 |
|
| 15 |
// Create lists for vendor-prefixed transform |
| 16 |
@each $list in $properties { |
| 17 |
@if nth($list, 1) == "transform" { |
| 18 |
$needs-prefixes: true; |
| 19 |
$list1: -webkit-transform; |
| 20 |
$list2: -moz-transform; |
| 21 |
$list3: (); |
| 22 |
|
| 23 |
@each $var in $list { |
| 24 |
$list3: join($list3, $var); |
| 25 |
|
| 26 |
@if $var != "transform" { |
| 27 |
$list1: join($list1, $var); |
| 28 |
$list2: join($list2, $var); |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
$webkit: append($webkit, $list1); |
| 33 |
$moz: append($moz, $list2); |
| 34 |
$spec: append($spec, $list3); |
| 35 |
} @else { |
| 36 |
$webkit: append($webkit, $list, comma); |
| 37 |
$moz: append($moz, $list, comma); |
| 38 |
$spec: append($spec, $list, comma); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
@if $needs-prefixes { |
| 43 |
-webkit-transition: $webkit; |
| 44 |
-moz-transition: $moz; |
| 45 |
transition: $spec; |
| 46 |
} @else { |
| 47 |
@if length($properties) >= 1 { |
| 48 |
@include prefixer(transition, $properties, webkit moz spec); |
| 49 |
} @else { |
| 50 |
$properties: all 0.15s ease-out 0s; |
| 51 |
@include prefixer(transition, $properties, webkit moz spec); |
| 52 |
} |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
@mixin transition-property($properties...) { |
| 57 |
@include _bourbon-deprecate-for-prefixing("transition-property"); |
| 58 |
|
| 59 |
-webkit-transition-property: transition-property-names($properties, "webkit"); |
| 60 |
-moz-transition-property: transition-property-names($properties, "moz"); |
| 61 |
transition-property: transition-property-names($properties, false); |
| 62 |
} |
| 63 |
|
| 64 |
@mixin transition-duration($times...) { |
| 65 |
@include _bourbon-deprecate-for-prefixing("transition-duration"); |
| 66 |
|
| 67 |
@include prefixer(transition-duration, $times, webkit moz spec); |
| 68 |
} |
| 69 |
|
| 70 |
@mixin transition-timing-function($motions...) { |
| 71 |
@include _bourbon-deprecate-for-prefixing("transition-timing-function"); |
| 72 |
|
| 73 |
// ease | linear | ease-in | ease-out | ease-in-out | cubic-bezier() |
| 74 |
@include prefixer(transition-timing-function, $motions, webkit moz spec); |
| 75 |
} |
| 76 |
|
| 77 |
@mixin transition-delay($times...) { |
| 78 |
@include _bourbon-deprecate-for-prefixing("transition-delay"); |
| 79 |
|
| 80 |
@include prefixer(transition-delay, $times, webkit moz spec); |
| 81 |
} |