summaryrefslogtreecommitdiff
path: root/app/assets/stylesheets/framework/animations.scss
blob: 0a26b4c6a8cef2abddcf1a79b5e20573511f45b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// This file is based off animate.css 3.5.1, available here:
// https://github.com/daneden/animate.css/blob/3.5.1/animate.css
//
// animate.css - http://daneden.me/animate
// Version - 3.5.1
// Licensed under the MIT license - http://opensource.org/licenses/MIT
//
// Copyright (c) 2016 Daniel Eden

.animated {
  @include webkit-prefix(animation-duration, 1s);
  @include webkit-prefix(animation-fill-mode, both);

  &.infinite {
    @include webkit-prefix(animation-iteration-count, infinite);
  }

  &.once {
    @include webkit-prefix(animation-iteration-count, 1);
  }

  &.hinge {
    @include webkit-prefix(animation-duration, 2s);
  }

  &.flipOutX,
  &.flipOutY,
  &.bounceIn,
  &.bounceOut {
    @include webkit-prefix(animation-duration, .75s);
  }

  &.short {
    @include webkit-prefix(animation-duration, 321ms);
    @include webkit-prefix(animation-fill-mode, none);
  }
}

@include keyframes(pulse) {
  from,
  to {
    @include webkit-prefix(transform, scale3d(1, 1, 1));
  }

  50% {
    @include webkit-prefix(transform, scale3d(1.05, 1.05, 1.05));
  }
}

.pulse {
  @include webkit-prefix(animation-name, pulse);
}

/*
* General hover animations
*/


// Sass multiple transitions mixin | https://gist.github.com/tobiasahlin/7a421fb9306a4f518aab
// Usage:   @include transition(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 transition($transitions...) {
  $unfoldedTransitions: ();
  @each $transition in $transitions {
    $unfoldedTransitions: append($unfoldedTransitions, unfoldTransition($transition), comma);
  }

  transition: $unfoldedTransitions;
}

@mixin disableAllAnimation {
  /*CSS transitions*/
  -o-transition-property: none !important;
  -moz-transition-property: none !important;
  -ms-transition-property: none !important;
  -webkit-transition-property: none !important;
  transition-property: none !important;
  /*CSS transforms*/
  -o-transform: none !important;
  -moz-transform: none !important;
  -ms-transform: none !important;
  -webkit-transform: none !important;
  transform: none !important;
  /*CSS animations*/
  -webkit-animation: none !important;
  -moz-animation: none !important;
  -o-animation: none !important;
  -ms-animation: none !important;
  animation: none !important;
}

@function unfoldTransition ($transition) {
  // Default values
  $property: all;
  $duration: $general-hover-transition-duration;
  $easing: $general-hover-transition-curve; // 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;
}

.btn,
.side-nav-toggle {
  @include transition(background-color, border-color, color, box-shadow);
}

.dropdown-menu-toggle,
.avatar-circle,
.header-user-avatar {
  @include transition(border-color);
}

.note-action-button .link-highlight,
.toolbar-btn,
.dropdown-toggle-caret,
.fa:not(.fa-bell) {
  @include transition(color);
}

a {
  @include transition(background-color, color, border);
}

.stage-nav-item {
  @include transition(background-color, box-shadow);
}

.nav-sidebar a,
.dropdown-menu a,
.dropdown-menu button,
.dropdown-menu-nav a {
  transition: none;
}