<div class="progress-container">
<div class="progress-item">
<div class="progress-header">
<span class="skill-name">HTML/CSS</span>
<span class="percentage" data-target="90">0%</span>
</div>
<div class="progress-bar">
<div class="progress-fill" data-width="90"></div>
</div>
</div>
<div class="progress-item">
<div class="progress-header">
<span class="skill-name">JavaScript</span>
<span class="percentage" data-target="85">0%</span>
</div>
<div class="progress-bar">
<div class="progress-fill" data-width="85"></div>
</div>
</div>
<div class="progress-item">
<div class="progress-header">
<span class="skill-name">React</span>
<span class="percentage" data-target="75">0%</span>
</div>
<div class="progress-bar">
<div class="progress-fill" data-width="75"></div>
</div>
</div>
<div class="progress-item">
<div class="progress-header">
<span class="skill-name">Node.js</span>
<span class="percentage" data-target="70">0%</span>
</div>
<div class="progress-bar">
<div class="progress-fill" data-width="70"></div>
</div>
</div>
<button class="animate-btn" onclick="animateProgress()">Animate Progress</button>
</div>
.progress-container {
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
padding: 30px;
border-radius: 15px;
max-width: 500px;
margin: 0 auto;
}
.progress-item {
margin-bottom: 25px;
}
.progress-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.skill-name {
font-weight: 600;
color: #333;
font-size: 16px;
}
.percentage {
font-weight: 700;
color: #667eea;
font-size: 14px;
min-width: 40px;
text-align: right;
}
.progress-bar {
height: 12px;
background: rgba(255, 255, 255, 0.3);
border-radius: 10px;
overflow: hidden;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
position: relative;
}
.progress-fill {
height: 100%;
width: 0%;
background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
border-radius: 10px;
transition: width 2s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
overflow: hidden;
}
.progress-fill::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.4),
transparent
);
transform: translateX(-100%);
animation: shimmer 2s ease-in-out;
}
.progress-fill.animate::after {
animation: shimmer 2s ease-in-out;
}
.animate-btn {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
padding: 12px 24px;
border-radius: 25px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
margin-top: 20px;
width: 100%;
}
.animate-btn:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}
@keyframes shimmer {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(100%);
}
}
@keyframes countUp {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
function animateProgress() {
const progressFills = document.querySelectorAll('.progress-fill');
const percentages = document.querySelectorAll('.percentage');
// Reset all progress bars
progressFills.forEach(fill => {
fill.style.width = '0%';
fill.classList.remove('animate');
});
percentages.forEach(percentage => {
percentage.textContent = '0%';
});
// Animate each progress bar with delay
progressFills.forEach((fill, index) => {
setTimeout(() => {
const targetWidth = fill.getAttribute('data-width');
const percentage = percentages[index];
const targetValue = parseInt(percentage.getAttribute('data-target'));
// Animate width
fill.style.width = targetWidth + '%';
fill.classList.add('animate');
// Animate percentage counter
let currentValue = 0;
const increment = targetValue / 60; // 60 frames for smooth animation
const counter = setInterval(() => {
currentValue += increment;
if (currentValue >= targetValue) {
currentValue = targetValue;
clearInterval(counter);
}
percentage.textContent = Math.round(currentValue) + '%';
}, 33); // ~30fps
}, index * 200); // Stagger animation
});
}
// Auto-animate on load
document.addEventListener('DOMContentLoaded', function() {
setTimeout(animateProgress, 500);
});