File tree Expand file tree Collapse file tree 6 files changed +198
-14
lines changed Expand file tree Collapse file tree 6 files changed +198
-14
lines changed Original file line number Diff line number Diff line change 1
- .neptune-spin {
2
- animation : spin 1s 0s infinite;
3
- ani
1
+
2
+
3
+ /* Fading Animations */
4
+ @import url ('./src/css/fade/neptune_fade_in.css' );
5
+ @import url ('./src/css/fade/neptune_fade_out.css' );
6
+
7
+ /* Rotate Animations */
8
+ /* Rotate Right */
9
+ .nep-rotate-right {
10
+ animation : nep-rotate-right var (--nep-animation-duration ) var (--nep-animation-delay ) var (--nep-animation-direction ) var (--nep-animation-fillmode );
4
11
}
5
12
6
- @keyframes spin {
13
+ @keyframes nep-rotate-right {
7
14
100% { transform : rotate (360deg );}
8
15
}
9
16
17
+ /* Rotate Left */
18
+ .nep-rotate-left {
19
+ animation : nep-rotate-left var (--nep-animation-duration ) var (--nep-animation-delay ) var (--nep-animation-direction ) var (--nep-animation-fillmode );
20
+ }
21
+
22
+ @keyframes nep-rotate-left {
23
+ 100% { transform : rotate (-360deg );}
24
+ }
25
+
10
26
11
27
12
- . test {
13
- margin : 15 rem ;
14
- width : 4 rem ;
15
- height : 4 rem ;
16
- background-color : aqua ;
28
+ : root {
29
+ --nep-animation-duration : 1 s ;
30
+ --nep-animation-delay : 0 s ;
31
+ --nep-animation-direction : ;
32
+ --nep-animation-fillmode : forwards ;
17
33
}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ export default class NeptuneAnimate {
3
3
this . element = element ;
4
4
this . animationClass = animationClass ;
5
5
this . animationEndEvent = this . getAnimationEndEvent ( ) ;
6
+ this . stop = this . startAnimation ( ) ;
6
7
7
8
this . element . addEventListener ( this . animationEndEvent , this . handleAnimationEnd . bind ( this ) ) ;
8
9
}
Original file line number Diff line number Diff line change
1
+ /* Fade-in */
2
+ .nep-fade-in {
3
+ animation : nep-fade-in var (--nep-animation-duration ) var (--nep-animation-delay ) var (--nep-animation-direction ) var (--nep-animation-fillmode );
4
+ }
5
+
6
+ @keyframes nep-fade-in {
7
+ 0% {
8
+ opacity : 0 ;
9
+ }
10
+
11
+ 100% {
12
+ opacity : 1 ;
13
+ }
14
+ }
15
+
16
+ /* Fade-in-down */
17
+ .nep-fade-in-down {
18
+ animation : nep-fade-in-down var (--nep-animation-duration ) var (--nep-animation-delay ) var (--nep-animation-direction ) var (--nep-animation-fillmode );
19
+ }
20
+
21
+ @keyframes nep-fade-in-down {
22
+ 0% {
23
+ opacity : 0 ;
24
+ transform : translateY (-5rem );
25
+ }
26
+
27
+ 100% {
28
+ opacity : 1 ;
29
+ transform : translateY (0 );
30
+ }
31
+ }
32
+
33
+ /* Fade-in-right */
34
+ .nep-fade-in-right {
35
+ animation : nep-fade-in-right var (--nep-animation-duration ) var (--nep-animation-delay ) var (--nep-animation-direction ) var (--nep-animation-fillmode );
36
+ }
37
+
38
+ @keyframes nep-fade-in-right {
39
+ 0% {
40
+ opacity : 0 ;
41
+ transform : translateX (-5rem );
42
+ }
43
+
44
+ 100% {
45
+ opacity : 1 ;
46
+ transform : translateX (0 );
47
+ }
48
+ }
49
+
50
+ /* Fade-in-up */
51
+ .nep-fade-in-up {
52
+ animation : nep-fade-in-up var (--nep-animation-duration ) var (--nep-animation-delay ) var (--nep-animation-direction ) var (--nep-animation-fillmode );
53
+ }
54
+
55
+ @keyframes nep-fade-in-up {
56
+ 0% {
57
+ opacity : 0 ;
58
+ transform : translateY (5rem );
59
+ }
60
+
61
+ 100% {
62
+ opacity : 1 ;
63
+ transform : translateY (0 );
64
+ }
65
+ }
66
+
67
+ /* Fade-in-left */
68
+ .nep-fade-in-left {
69
+ animation : nep-fade-in-left var (--nep-animation-duration ) var (--nep-animation-delay ) var (--nep-animation-direction ) var (--nep-animation-fillmode );
70
+ }
71
+
72
+ @keyframes nep-fade-in-left {
73
+ 0% {
74
+ opacity : 0 ;
75
+ transform : translateX (5rem );
76
+ }
77
+
78
+ 100% {
79
+ opacity : 1 ;
80
+ transform : translateX (0 );
81
+ }
82
+ }
Original file line number Diff line number Diff line change
1
+ /* Fade-out */
2
+ .nep-fade-out {
3
+ animation : nep-fade-out var (--nep-animation-duration ) var (--nep-animation-delay ) var (--nep-animation-direction ) var (--nep-animation-fillmode );
4
+ }
5
+
6
+ @keyframes nep-fade-out {
7
+ 0% {
8
+ opacity : 1 ;
9
+ }
10
+
11
+ 100% {
12
+ opacity : 0 ;
13
+ }
14
+ }
15
+
16
+ /* Fade-out-up */
17
+ .nep-fade-out-up {
18
+ animation : nep-fade-out-up var (--nep-animation-duration ) var (--nep-animation-delay ) var (--nep-animation-direction ) var (--nep-animation-fillmode );
19
+ }
20
+
21
+ @keyframes nep-fade-out-up {
22
+ 0% {
23
+ opacity : 1 ;
24
+ transform : translateY (0 );
25
+ }
26
+
27
+ 100% {
28
+ opacity : 0 ;
29
+ transform : translateY (-5rem );
30
+ }
31
+ }
32
+
33
+ /* Fade-out-left */
34
+ .nep-fade-out-left {
35
+ animation : nep-fade-out-left var (--nep-animation-duration ) var (--nep-animation-delay ) var (--nep-animation-direction ) var (--nep-animation-fillmode );
36
+ }
37
+
38
+ @keyframes nep-fade-out-left {
39
+ 0% {
40
+ opacity : 1 ;
41
+ transform : translateX (0 );
42
+ }
43
+
44
+ 100% {
45
+ opacity : 0 ;
46
+ transform : translateX (-5rem );
47
+ }
48
+ }
49
+
50
+ /* Fade-out-down */
51
+ .nep-fade-out-down {
52
+ animation : nep-fade-out-down var (--nep-animation-duration ) var (--nep-animation-delay ) var (--nep-animation-direction ) var (--nep-animation-fillmode );
53
+ }
54
+
55
+ @keyframes nep-fade-out-down {
56
+ 0% {
57
+ opacity : 1 ;
58
+ transform : translateY (0 );
59
+ }
60
+
61
+ 100% {
62
+ opacity : 0 ;
63
+ transform : translateY (5rem );
64
+ }
65
+ }
66
+
67
+ /* Fade-out-right */
68
+ .nep-fade-out-right {
69
+ animation : nep-fade-out-right var (--nep-animation-duration ) var (--nep-animation-delay ) var (--nep-animation-direction ) var (--nep-animation-fillmode );
70
+ }
71
+
72
+ @keyframes nep-fade-out-right {
73
+ 0% {
74
+ opacity : 1 ;
75
+ transform : translateX (0 );
76
+ }
77
+
78
+ 100% {
79
+ opacity : 0 ;
80
+ transform : translateX (5rem );
81
+ }
82
+ }
Original file line number Diff line number Diff line change 5
5
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
6
7
7
< link rel ="stylesheet " href ="../neptune-animations.css ">
8
+ < link rel ="stylesheet " href ="test.css ">
8
9
9
10
< title > Document</ title >
10
11
</ head >
15
16
import NeptuneAnimate from "../neptune-animations.js"
16
17
17
18
const myElement = document . getElementById ( "test" ) ;
18
- const neptuneAnimate = new NeptuneAnimate ( myElement , "neptune-spin " ) ;
19
+ const neptuneAnimate = new NeptuneAnimate ( myElement , "nep-fade-out-right " ) ;
19
20
20
21
neptuneAnimate . startAnimation ( ) ;
21
-
22
- setTimeout ( function ( ) {
23
- neptuneAnimate . stopAnimation ( ) ;
24
- } , 5000 ) ;
25
22
</ script >
26
23
</ body >
27
24
</ html >
Original file line number Diff line number Diff line change
1
+ .test {
2
+ margin : 15rem ;
3
+ width : 4rem ;
4
+ height : 4rem ;
5
+ background-color : aqua;
6
+ }
You can’t perform that action at this time.
0 commit comments