|
|
|
@ -169,26 +169,25 @@ function animateElementsSequentially(index = 0) { |
|
|
|
const highestBar = sortedPercentages[0] |
|
|
|
const lowestBar = sortedPercentages[sortedPercentages.length - 1] |
|
|
|
|
|
|
|
let equalHeight = answerDistributions[0].offsetHeight |
|
|
|
let equalHeight = answerDistributions[0].offsetHeight |
|
|
|
|
|
|
|
answerDistributions.forEach((bar, i) => { |
|
|
|
let fakeHeight, finalHeight |
|
|
|
|
|
|
|
if (i === highestBar.index) { |
|
|
|
fakeHeight = containerHeight * 0.3 |
|
|
|
fakeHeight = containerHeight * (0.3 + ((Math.random() - 0.5) * 0.2)) |
|
|
|
} else if (i === lowestBar.index) { |
|
|
|
fakeHeight = containerHeight * 0.8 |
|
|
|
fakeHeight = containerHeight * (0.8 + ((Math.random() - 0.5) * 0.2)) |
|
|
|
} else { |
|
|
|
fakeHeight = containerHeight * 0.5 |
|
|
|
fakeHeight = containerHeight * (0.5 + ((Math.random() - 0.5) * 0.2)) |
|
|
|
} |
|
|
|
|
|
|
|
finalHeight = targetHeights[i] |
|
|
|
|
|
|
|
gsap.to(bar, { |
|
|
|
keyframes: [ |
|
|
|
{ height: fakeHeight, duration: 0.4, ease: "power2.out" }, |
|
|
|
{ height: equalHeight, duration: 0.4, ease: "power2.inOut" }, |
|
|
|
{ height: finalHeight, duration: 0.4, ease: "power2.out" } |
|
|
|
{ height: fakeHeight, duration: 0.3, ease: "power2.inOut" }, |
|
|
|
{ height: finalHeight, duration: 0.4, ease: "power2.in" } |
|
|
|
], |
|
|
|
onComplete: () => { |
|
|
|
if (bar.dataset.answered != undefined) { |
|
|
|
@ -212,15 +211,10 @@ function animateElementsSequentially(index = 0) { |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
animateElementsSequentially(index + 1) |
|
|
|
|
|
|
|
|
|
|
|
animateElementsSequentially(index + 1) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
@ -234,8 +228,8 @@ function animateElementsSequentially(index = 0) { |
|
|
|
function typeWriterConsoleSequential(container, options = {}) { |
|
|
|
const { |
|
|
|
selector = '.typewriter-text', |
|
|
|
baseSpeed = 60, |
|
|
|
divDelay = 400, |
|
|
|
baseSpeed = 40, |
|
|
|
divDelay = 200, |
|
|
|
showCursor = true, |
|
|
|
onDivComplete = null, |
|
|
|
onAllComplete = null |
|
|
|
@ -344,7 +338,7 @@ function typeWriterConsoleSequential(container, options = {}) { |
|
|
|
|
|
|
|
let charIndex = 0 |
|
|
|
// Add 1 second delay for first div to let cursor blink twice
|
|
|
|
let nextCharTime = performance.now() + (isFirstDiv ? 1100 : 100) |
|
|
|
let nextCharTime = performance.now() + (isFirstDiv ? 20 : 20) |
|
|
|
|
|
|
|
function typeFrame(currentTime) { |
|
|
|
if (!isActive) { |
|
|
|
@ -361,7 +355,8 @@ function typeWriterConsoleSequential(container, options = {}) { |
|
|
|
updateDivContent(currentDiv, currentText, true) |
|
|
|
|
|
|
|
// Calculate delay for next character
|
|
|
|
let delay = baseSpeed + Math.random() * 15 |
|
|
|
// let delay = baseSpeed + Math.random() * 15
|
|
|
|
let delay = baseSpeed |
|
|
|
const char = originalText.charAt(charIndex - 1) |
|
|
|
|
|
|
|
if (char === '.' || char === '!' || char === '?') { |
|
|
|
|