-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
69 lines (56 loc) · 1.94 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
import Typed from 'typed.js';
import confetti from "canvas-confetti";
const typed = new Typed('#element', {
strings: ['full stack developer.', 'passionate learner.', 'part time problem solver.'],
typeSpeed: 50,
loop: true
});
const typed1 = new Typed('#element1', {
strings: ['social media!', 'Twitter', 'Instagram', 'Discord', 'LinkedIn', 'Github'],
typeSpeed: 50,
loop: true
});
// hover photo effect
const myPhoto = document.getElementById("my-photo");
const sayHello = document.getElementById("say-hello");
myPhoto.addEventListener('mouseover', () => {
myPhoto.setAttribute('src', 'profile/photo-me1.png');
sayHello.style.visibility = "visible";
sayHello.style.opacity = 1;
})
myPhoto.addEventListener('mouseleave', () => {
myPhoto.setAttribute('src', 'profile/photo-me0.png');
sayHello.style.visibility = "hidden";
})
// Add smooth scrolling behavior when clicking on navigation links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
const appreciateBtn = document.getElementById("flying-butterfly");
appreciateBtn.addEventListener("click", () => {
const myCanvas = document.createElement("canvas");
myCanvas.style.position = "fixed";
myCanvas.style.inset = 0;
myCanvas.style.width = "100vw";
myCanvas.style.height = "100vh";
myCanvas.style.zIndex = -1;
document.body.appendChild(myCanvas);
const myConfetti = confetti.create(myCanvas, {
resize: true,
useWorker: true,
});
const sakura = confetti.shapeFromText({ text: '🌸' });
const rosette = confetti.shapeFromText({ text: '🏵️'});
const white = confetti.shapeFromText({ text: '💮'});
const clover = confetti.shapeFromText({ text: '🍀'});
myConfetti({
shapes: [sakura, rosette, white, clover],
particleCount: 100,
spread: 160,
});
});