Function bodies 8 total
resizeCanvas function · javascript · L25-L28 (4 LOC)js/script.js
function resizeCanvas() {
canvas.width = canvas.parentElement.offsetWidth;
canvas.height = canvas.parentElement.offsetHeight;
}Particle function · javascript · L42-L49 (8 LOC)js/script.js
function Particle() {
this.x = Math.random() * canvas.width;
this.y = Math.random() * canvas.height;
this.size = Math.random() * 2 + 0.5;
this.speedX = (Math.random() - 0.5) * 0.8;
this.speedY = (Math.random() - 0.5) * 0.8;
this.opacity = Math.random() * 0.5 + 0.2;
}initParticles function · javascript · L77-L83 (7 LOC)js/script.js
function initParticles() {
particles = [];
var count = Math.min(80, Math.floor(canvas.width * canvas.height / 12000));
for (var i = 0; i < count; i++) {
particles.push(new Particle());
}
}connectParticles function · javascript · L86-L103 (18 LOC)js/script.js
function connectParticles() {
for (var a = 0; a < particles.length; a++) {
for (var b = a + 1; b < particles.length; b++) {
var dx = particles[a].x - particles[b].x;
var dy = particles[a].y - particles[b].y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist < 120) {
var opacity = (1 - dist / 120) * 0.15;
ctx.strokeStyle = 'rgba(108, 99, 255, ' + opacity + ')';
ctx.lineWidth = 0.5;
ctx.beginPath();
ctx.moveTo(particles[a].x, particles[a].y);
ctx.lineTo(particles[b].x, particles[b].y);
ctx.stroke();
}
}
}
}animateParticles function · javascript · L105-L113 (9 LOC)js/script.js
function animateParticles() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < particles.length; i++) {
particles[i].update();
particles[i].draw();
}
connectParticles();
requestAnimationFrame(animateParticles);
}typeEffect function · javascript · L131-L155 (25 LOC)js/script.js
function typeEffect() {
if (!typewriterEl) return;
var currentRole = roles[roleIndex];
if (isDeleting) {
typewriterEl.textContent = currentRole.substring(0, charIndex - 1);
charIndex--;
} else {
typewriterEl.textContent = currentRole.substring(0, charIndex + 1);
charIndex++;
}
var speed = isDeleting ? 30 : 60;
if (!isDeleting && charIndex === currentRole.length) {
speed = 2000;
isDeleting = true;
} else if (isDeleting && charIndex === 0) {
isDeleting = false;
roleIndex = (roleIndex + 1) % roles.length;
speed = 300;
}
setTimeout(typeEffect, speed);
}animateCounters function · javascript · L160-L194 (35 LOC)js/script.js
function animateCounters() {
if (countersAnimated) return;
var counters = document.querySelectorAll('.counter');
var allVisible = false;
counters.forEach(function (counter) {
var rect = counter.getBoundingClientRect();
if (rect.top < window.innerHeight && rect.bottom > 0) {
allVisible = true;
}
});
if (allVisible) {
countersAnimated = true;
counters.forEach(function (counter) {
var target = parseInt(counter.getAttribute('data-target'));
var duration = 1500;
var start = 0;
var startTime = null;
function step(timestamp) {
if (!startTime) startTime = timestamp;
var progress = Math.min((timestamp - startTime) / duration, 1);
var eased = 1 - Math.pow(1 - progress, 3);
counter.textContent = Math.floor(easeRepobility · code-quality intelligence · https://repobility.com
step function · javascript · L180-L190 (11 LOC)js/script.js
function step(timestamp) {
if (!startTime) startTime = timestamp;
var progress = Math.min((timestamp - startTime) / duration, 1);
var eased = 1 - Math.pow(1 - progress, 3);
counter.textContent = Math.floor(eased * target);
if (progress < 1) {
requestAnimationFrame(step);
} else {
counter.textContent = target;
}
}