From 57a62e4b78ee5803f0ef51218b314855b5c5b504 Mon Sep 17 00:00:00 2001 From: Mattias Bodlund Date: Wed, 28 May 2025 15:37:49 +0200 Subject: [PATCH] na --- app/javascript/application.js | 29 ++++++++++++----------------- app/views/questions/result.html.erb | 2 +- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/app/javascript/application.js b/app/javascript/application.js index 0b0ba79..7b9d132 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -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 === '?') { diff --git a/app/views/questions/result.html.erb b/app/views/questions/result.html.erb index 8198604..38d9a78 100644 --- a/app/views/questions/result.html.erb +++ b/app/views/questions/result.html.erb @@ -26,7 +26,7 @@
- <%= link_to tag.span(t('read_more')), t('read_more_link'), class: 'button__base' %> + <%= link_to tag.span(t('read_more')), t('read_more_link'), class: 'button__base', target: '_blank' %> <%= button_tag tag.span(t('share_on_story')), data: { share_title: t('share.title'),