meese-enterprises / website

The landing page for Meese Enterprises
https://meese.enterprises
MIT License
1 stars 1 forks source link

Add typing animation on employee card hover #16

Open ajmeese7 opened 2 years ago

ajmeese7 commented 2 years ago

Idea inspired by the awesome suggestion from @Pirijan here.

lodenrogue commented 2 years ago

You could do something like this for a typing animation effect:

function type(words, delay, callback) {
    for(let i = 0; i <= words.length; i++) {
        let timeoutDelay = delay * (i + 1);
        setTimeout(() => callback(words.slice(0, i)), timeoutDelay);
    }
}

Callback is a function that takes a string as an argument. It'll be called with the progress of the typing. You can use this callback to update your UI.