123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- /*--------------------------------------------------------------*/
- /* !## Animations */
- /*--------------------------------------------------------------*/
- // Using the mixins looks like this:
- // @include keyframes(move-the-object) {
- // 0% { left: 100px; }
- // 100% { left: 200px; }
- // }
- //
- // .object-to-animate {
- // @include animation('move-the-object .5s 1', 'move-the-object-again .5s 1 .5s');
- // }
- // Order from longest to shortest
- // If anything changes edit here!!
- $default-prefixes: webkit moz ms o;
- // Prefixer mixin
- // $attr: property to be prefixed (transition, transform, box-shadow), can be added via another mixin or directly
- // $value: value of the property
- // $prefixes: by default it uses those defined as default, but can be changed to those needed
- @mixin prefix( $attr, $value, $prefixes: $default-prefixes ) {
- // Output each prefixed rule
- @each $prefix in $prefixes {
- -#{ $prefix }-#{ $attr }: #{ $value };
- }
- // Non prefixed rule
- #{ $attr }: #{ $value };
- }
- // Multi-transition mixins
- //
- // Src: https://gist.github.com/tobiasahlin/7a421fb9306a4f518aab
- //
- // Usage: @include multitransition(width, height 0.3s ease-in-out);
- // Output: -webkit-transition(width 0.2s, height 0.3s ease-in-out);
- // transition(width 0.2s, height 0.3s ease-in-out);
- //
- // Pass in any number of transitions
- @mixin multitransition($transitions...) {
- $unfoldedTransitions: ();
- @each $transition in $transitions {
- $unfoldedTransitions: append($unfoldedTransitions, unfoldTransition($transition), comma);
- }
- -webkit-transition: $unfoldedTransitions;
- transition: $unfoldedTransitions;
- }
- // Unfold transition mixin
- @function unfoldTransition ($transition) {
- // Default values
- $property: all;
- $duration: .2s;
- $easing: null; // Browser default is ease, which is what we want
- $delay: null; // Browser default is 0, which is what we want
- $defaultProperties: ($property, $duration, $easing, $delay);
- // Grab transition properties if they exist
- $unfoldedTransition: ();
- @for $i from 1 through length($defaultProperties) {
- $p: null;
- @if $i <= length($transition) {
- $p: nth($transition, $i)
- } @else {
- $p: nth($defaultProperties, $i)
- }
- $unfoldedTransition: append($unfoldedTransition, $p);
- }
- @return $unfoldedTransition;
- }
- // Transition mixin
- @mixin transition( $attr, $delay, $fx ) {
- $value: $attr $delay $fx;
- @include prefix( 'transition', $value );
- }
- // example: @include transition(color, .8s, linear);
- // Transform mixin
- @mixin transform( $attr, $value ) {
- $property: str_insert( $attr, '()', -1 );
- $prop: str_insert( $property, #{ $value }, -2 );
- @include prefix( 'transform', $prop );
- }
- // example: @include transform(transformX, -100%);
- // Prefixed animations
- @mixin animation( $animate... ) {
- $max: length( $animate );
- $animations: '';
- @for $i from 1 through $max {
- $animations: #{ $animations + nth( $animate, $i ) };
- @if $i < $max {
- $animations: #{ $animations + ", " };
- }
- }
- -webkit-animation: $animations;
- -moz-animation: $animations;
- -o-animation: $animations;
- animation: $animations;
- }
- // Keyframes settings
- @mixin keyframes( $animationName ) {
- @-webkit-keyframes #{ $animationName } {
- @content;
- }
- @-moz-keyframes #{ $animationName } {
- @content;
- }
- @-o-keyframes #{ $animationName } {
- @content;
- }
- @keyframes #{ $animationName } {
- @content;
- }
- }
- @include keyframes( bounce-reveal-y ) {
- 0%,
- 100% {
- @include transform( scaleY, 1 ); // -webkit-transform: scaleY(1);
- }
- 50% {
- @include transform( scaleY, 1.1 ); // -webkit-transform: scaleY(1.1);
- }
- }
- @include keyframes( bounce-hide-y ) {
- 0%,
- 100% {
- @include transform( scaleY, 1 ); // -webkit-transform: scaleY(1);
- }
- 50% {
- @include transform( scaleY, .9 ); // -webkit-transform: scaleY(1.1);
- }
- }
- @include keyframes( bounce-reveal ) {
- 0%,
- 100% {
- @include transform( scale, 1 );
- }
- 33% {
- @include transform( scale, 1.1 );
- }
- 66% {
- @include transform( scale, 0.9 );
- }
- }
- @include keyframes( bounce-left ) {
- 0%,
- 100% {
- @include transform( translateX, 0 );
- }
- 33% {
- @include transform( translateX, -10px );
- }
- 66% {
- @include transform( translateX, 3px );
- }
- }
- @include keyframes( bounce-right ) {
- 0%,
- 100% {
- @include transform( translateX, 1 );
- }
- 33% {
- @include transform( translateX, 10px );
- }
- 66% {
- @include transform( translateX, -3px );
- }
- }
- @include keyframes( bounce-reveal-large ) {
- 0%,
- 100% {
- @include transform( scale, 1 );
- }
- 33% {
- @include transform( scale, 1.25 );
- }
- 66% {
- @include transform( scale, 0.85 );
- }
- }
- @include keyframes( bounce-zoom ) {
- 0% {
- @include transform( scale, 1 );
- }
- 25% {
- @include transform( scale, 1.1 );
- }
- 75% {
- @include transform( scale, 0.9 );
- }
- 100% {
- @include transform( scale, 1.125 );
- }
- }
- // @-webkit-keyframes 'bounce-reveal' {
- // 0% { -webkit-transform: scale(0.3); }
- // 33% { -webkit-transform: scale(1.1); }
- // 66% { -webkit-transform: scale(0.9); }
- // 100% { -webkit-transform: scale(1); }
- // }
- // -webkit-animation: bounce-reveal 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
- // .tag-list-wrap {
- //
- // margin-left:-999em;
- // -webkit-transform-origin: top left;
- // cursor: pointer;
- // position: absolute;
- // top: 0;
- //
- // &:hover .tag-list-wrap {
- //
- // .tags();
- // background: rgb(23, 23, 23);
- // padding: @gutter;
- // z-index: 20;
- // display: table;
- // word-spacing: normal;
- // position: absolute;
- // top: 0;
- // margin-left: 0;
- // -webkit-animation: bounce-reveal 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
- // }
- // }
|