-
Notifications
You must be signed in to change notification settings - Fork 0
/
curlySprite.scss
94 lines (84 loc) · 2.19 KB
/
curlySprite.scss
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
@mixin animateSprite ($name, $seconds, $cols, $rows, $end, $width, $height, $loop, $animation) {
$infinite: 'forwards';
@if $loop == loop {
$infinite: infinite;
}
width: #{$width}px;
height: #{$height}px;
-webkit-animation: #{$name}-#{$cols}x#{$rows} #{$seconds}s steps(1) #{$infinite} #{$animation};
-moz-animation: #{$name}-#{$cols}x#{$rows} #{$seconds}s steps(1) #{$infinite} #{$animation};
-o-animation: #{$name}-#{$cols}x#{$rows} #{$seconds}s steps(1) #{$infinite} #{$animation};
animation: #{$name}-#{$cols}x#{$rows} #{$seconds}s steps(1) #{$infinite} #{$animation};
@-webkit-keyframes #{$name}-#{$cols}x#{$rows} {
$col: 0;
$row: 0;
@for $i from 1 through $end {
#{(100*$i)/$end}% { background-position: -#{$col*$width}px -#{$row*$height}px; }
$col: $col+1;
@if $col == $cols {
$col: 0;
$row: $row+1;
}
@if (#{$row}-1*$cols+$col) == $end+1 and not $loop == loop {
$col: 0;
$row: 0;
}
}
}
@-moz-keyframes #{$name}-#{$cols}x#{$rows} {
$col: 0;
$row: 0;
@for $i from 1 through $end {
#{(100*$i)/$end}% { background-position: -#{$col*$width}px -#{$row*$height}px; }
$col: $col+1;
@if $col == $cols {
$col: 0;
$row: $row+1;
}
@if (#{$row}-1*$cols+$col) == $end+1 and not $loop == loop {
$col: 0;
$row: 0;
}
}
}
@-o-keyframes #{$name}-#{$cols}x#{$rows} {
$col: 0;
$row: 0;
@for $i from 1 through $end {
#{(100*$i)/$end}% { background-position: -#{$col*$width}px -#{$row*$height}px; }
$col: $col+1;
@if $col == $cols {
$col: 0;
$row: $row+1;
}
@if (#{$row}-1*$cols+$col) == $end+1 and not $loop == loop {
$col: 0;
$row: 0;
}
}
}
@keyframes #{$name}-#{$cols}x#{$rows} {
$col: 0;
$row: 0;
@for $i from 1 through $end {
#{(100*$i)/$end}% { background-position: -#{$col*$width}px -#{$row*$height}px; }
$col: $col+1;
@if $col == $cols {
$col: 0;
$row: $row+1;
}
@if (#{$row}-1*$cols+$col) == $end+1 and not $loop == loop {
$col: 0;
$row: 0;
}
}
}
}
.curl {
width: 250px;
height: 250px;
background: url(curl.png);
&.move {
@include animateSprite(nameOfAnimation, 100/25, 10, 10, 100, 250, 250, false, '');
}
}