I will calculate the whole time which Typed.js takes to type custom sentences. I will start a soundtrack with some negative delay (depends on that soundtrack) at the end of typing finish time.
All sentence typing takes n milliseconds; I want to start the soundtrack (n - delay) milliseconds from the beginning of the typing process.
This n can be calculated from fadeOutDelay, startDelay, typeSpeed, but the diffing which Typed.js uses not to remove the previous sentence. Involvement of diffing algorithm in n calculation looks a bad practice for me, and I want to keep that diffing algorithm .
Here is packages I use:
"dependencies": {
"howler": "2.2.1",
"typed.js": "2.0.11"
},
All other solutions are welcomed.
edited
I added a simple demo with hard-coded timing for some sound.
- sound will no be played in this demo :)
- All of the stuff and timing must be dynamically calculated.
