-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
182 lines (133 loc) · 3.94 KB
/
script.js
File metadata and controls
182 lines (133 loc) · 3.94 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
var subtitle = "I am Ilias, a French engineering student interested in artificial intelligence. I want to help advance this field and make the world a better place.";
var delay = 40;
var subtitleElement = document.getElementById("subtitle");
function writeTitle() {
subtitleElement.innerHTML += subtitle[0];
subtitle = subtitle.substr(1);
if (subtitle.length > 0) {
setTimeout(writeTitle, delay);
}
}
writeTitle();
function scrollToElement(navbarButtonId, targetElementId) {
const navbarButton = document.querySelector(`#${navbarButtonId}`);
const targetElement = document.querySelector(`#${targetElementId}`);
navbarButton.addEventListener('click', () => {
targetElement.scrollIntoView({ behavior: 'smooth'});
});
}
scrollToElement('about-me-button','about');
scrollToElement('home-button','home');
scrollToElement('projects-button','contactt');
scrollToElement('contact-button','contact');
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
});
}
let collState = false;
const coll2 = document.getElementById('collapsible-element');
coll2.addEventListener('click', function(){
if (collState){
coll2.innerHTML = 'Read more...';
} else {
coll2.innerHTML = 'Read less';
}
collState = !collState;
});
var canvas = document.getElementById('canvas');
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(100, 1, 4, 1000);
camera.position.x = 0;
camera.position.y = 0;
camera.position.z =15;
var renderer = new THREE.WebGLRenderer({canvas: canvas});
renderer.setSize(335, 335);
var points = [
[1, 1, 1],
[1, 1, 1],
[1, 1, 1],
];
var geometry = new THREE.Geometry();
var sphereGeometry = new THREE.SphereGeometry(10);
for (var i = 0; i < points.length; i++) {
var point = new THREE.Vector3().fromArray(points[i]);
geometry.vertices.push(point);
}
var material = new THREE.PointsMaterial({
color: 0x90ee90,
size: 10,
sizeAttenuation: false
});
var points = new THREE.Points(sphereGeometry, material);
scene.add(points);
function onScroll(event) {
var scrollTop = window.scrollY;
console.log(scrollTop);
points.rotation.y = scrollTop * 0.005;
}
function animate() {
requestAnimationFrame(animate);
points.rotation.z += 0.02;
points.rotation.x += 0.01;
renderer.render(scene, camera);
}
window.addEventListener('scroll', onScroll);
animate();
document.addEventListener("DOMContentLoaded", function () {
const icons = document.querySelectorAll(".icon-container span.material-icons-outlined");
icons.forEach(icon => {
icon.addEventListener("mousedown", () => {
icon.classList.add("icon-animate");
});
icon.addEventListener("mouseup", () => {
icon.classList.remove("icon-animate");
});
icon.addEventListener("mouseleave", () => {
icon.classList.remove("icon-animate");
});
});
});
$(document).ready(function() {
var animationDuration = 600;
function linearEasing(t, b, c, d) {
return c * t / d + b;
}
function sineEasing(t, b, c, d) {
return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
}
function exponentialEasing(t, b, c, d) {
return c * Math.pow(2, 10 * (t / d - 1)) + b;
}
function easeInCubic(t, b, c, d) {
t /= d;
return c * t * t * t + b;
}
function easeOutCubic(t, b, c, d) {
t /= d;
t--;
return c * (t * t * t + 1) + b;
}
jQuery.extend(jQuery.easing, {
customEasing: function(x, t, b, c, d) {
return easeInCubic(t, b, c, d);
}
});
$('a[href^="#"]').on('click', function(event) {
var target = $(this.getAttribute('href'));
if (target.length) {
event.preventDefault();
$('html, body').stop().animate(
{
scrollTop: target.offset().top
},
{
duration: animationDuration,
easing: 'customEasing'
}
);
}
});
});