Hello,

I’m able to make texts fade in and out sequentially, like the following :

F
Fi
Fir
Firs
First
 irst
  rst
   st
    t
S
Se
Sec
Seco
Secon
Second
 econd
  cond
   ond
    nd
     d
T
Th
Thi
Thir
Third

Demo : https://jsfiddle.net/KaKi87/t3jm8yhx/2/

But I’d like to to make these fade in and out simultaneously, like the following :

F
Fi
Fir
Firs
First
S rst
Se st
Sec t
Seco
Secon
Second
T cond
Th ond
Thi nd
Thir d
Third

How to do that ?

Thanks !

  • hassanmckusick@lemmy.discothe.quest
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Your awaits are random and not synced to your animations. On line 5 you start a 500ms animation but you tell the await to pause for 2000ms. Try 500ms or even 300ms with the current easing.

    • KaKi87OP
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 year ago

      I set such delays so that I have time to watch things happening in devtools, that’s all.

      However, reducing delays still doesn’t allow the next text to appear simultaneously with the previous text disappearing.

      The solution is figuring out how to overlay the texts without requiring a background color.

  • silas@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Have you thought of splitting up the string into single letters and animating one letter at a time? The animation would be slightly different than the wipe animation you have going right now, but you wouldn’t have to worry about backgrounds anymore