-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
90 lines (73 loc) · 2.64 KB
/
main.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
import './css/style.css'
import anime from 'animejs'
document.addEventListener('DOMContentLoaded', function () {
let textWrapper = document.querySelector('#vael_victus');
textWrapper.innerHTML = textWrapper.textContent.replace(/\S/g, "<span class='letter'>$&</span>");
document.getElementById('vael_victus').style.display = 'block';
let content_delay = 900;
// fade in each section
document.querySelectorAll('section').forEach((el, i) => {
setTimeout(() => {
el.style.opacity = 1;
el.style.transform = 'translateY(0px)';
}, content_delay + i*300)
});
anime.timeline({loop: false})
.add({
targets: '#vael_victus .letter',
translateX: [40, 0],
translateZ: 0,
opacity: [0, 1],
easing: "easeOutCubic",
duration: 2000,
delay: (el, i) => 0 + (75 * i)
});
setTimeout(() => {
document.getElementById("web_dev").classList.add('fadeIn');
document.getElementById("game_dev").classList.add('fadeIn');
document.getElementById("writer").classList.add('fadeIn');
}, 750);
});
const petsSection = document.getElementById('pets_section');
document.getElementById('view_pets').addEventListener('click', function() {
const viewPetsText = document.getElementById('view_pets');
if (petsSection.classList.contains('vael-show')) {
// Hide the section
petsSection.classList.remove('vael-show');
viewPetsText.setAttribute('aria-expanded', 'false');
viewPetsText.innerHTML = 'show<span class="arrow">▾</span>';
// Wait for transition to complete before hiding
setTimeout(() => {
petsSection.style.display = 'none';
}, 450);
} else {
// Show the section
petsSection.style.display = 'block';
// Force a reflow and then start transition
requestAnimationFrame(() => {
petsSection.classList.add('vael-show');
viewPetsText.setAttribute('aria-expanded', 'true');
viewPetsText.innerHTML = 'hide<span class="arrow">▴</span>';
});
}
});
// ! HELPERS
window.copyToClipboard = function(message) {
var textArea = document.createElement("textarea");
textArea.value = message;
textArea.style.opacity = "0";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
document.execCommand('copy');
// *yawn*
document.getElementById('click2copy').innerHTML = '<b style="color: #228C22">✔ copied</b>';
setTimeout(() => {
document.getElementById('click2copy').innerHTML = 'click to copy';
}, 3000);
} catch (err) {
console.log('Unable to copy value , error : ' + err.message);
}
document.body.removeChild(textArea);
}