-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
112 lines (95 loc) · 3.22 KB
/
index.js
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
$(document).ready(function()
{
const padDigit = digit => {
return digit < 10 ? '0' + digit : digit;
};
const deadline = moment('2020-01-19T13:30:00')
var interval = null;
const calculateTime = () => {
const now = moment.now();
const timeDiff = deadline.diff(now);
if (timeDiff < 0) {
return {
hours: 0,
minutes: 0,
deadlinePassed: true
}
}
const timeRemaining = deadline.countdown();
const hours = timeRemaining.days * 24 + timeRemaining.hours;
const minutes = timeRemaining.minutes;
return {
hours,
minutes,
deadlinePassed: false
}
}
const setTime = () => {
time = calculateTime();
$('#hours').html(padDigit(time.hours));
$('#minutes').html(padDigit(time.minutes));
if (time.deadlinePassed) {
clearInterval(interval);
}
};
setTime();
interval = setInterval(setTime, 5000);
$.fn.extend({
animateCss: function (animationName, callback) {
const animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
this.addClass('animated ' + animationName).one(animationEnd, () => {
$(this).removeClass('animated ' + animationName);
if (callback) {
callback();
}
});
return this;
}
});
const countdownElement = $('.countdown');
const logoElement = $('.svg');
const animateLogo = () =>
{
$('.svg').show()
$('.svg path').css('animation', '5s linear rainbow')
$('div.circle').show()
$('div.circle').css('transform', 'translate(-50%, -50%) scale(8)');
setTimeout(() => {
countdownElement.hide();
$('div.circle').css('opacity', '0')
}, 400);
setTimeout(() => {
$('div.circle').hide();
$('div.circle').css('transform', 'translate(-50%, -50%) scale(0)');
$('div.circle').css('opacity', '1');
}, 1000);
$('.svg path').css('stroke-dashoffset', '0vh')
setTimeout(() => {// Wait for logo to draw
$('.svg').css('animation', 'grow-shrink 0.3s ease-in-out')
setTimeout(() => { // Wait a bit before doing anything
$('div.circle').show()
$('div.circle').css('transform', 'translate(-50%, -50%) scale(8)');
setTimeout(() => {
countdownElement.show();
$('.svg').hide()
$('.svg path').css('stroke-dashoffset', '-75vh')
$('.svg').css('animation', 'none')
$('div.circle').css('opacity', '0')
$('.svg path').css('animation', 'none')
}, 400);
setTimeout(() => {
$('div.circle').hide();
$('div.circle').css('transform', 'translate(-50%, -50%) scale(0)');
$('div.circle').css('opacity', '1');
}, 1000);
setTimeout(() => {
animateLogo();
}, logo_interval);
}, 4000);
}, 3000);
}
const logo_interval = 30000
setTimeout(() => {
animateLogo();
}, logo_interval);
})