Animate to just the initals of a name
Hello, I have been trying to have an animation where a name is reduced to just the initials.
I have tried setting keyframes from
width: auto
to width: 1ch
(with interpolate-size: allow-keywords;
set), but 1ch is too small to have the letter fully visible. Then I have tried setting the letter spacing to 0.2ch, and have the width animate to 1.2ch, but not every inital has the same width then.
7 Replies
Why not set up separate CSS for each group? Who says all the words need the exact same CSS? Consider using CSS custom properties that help even out the variable dimensions of the content segments.
Will depend on the font you're using, a monospace font could help.
This sounds like a great use case for gsap imo
I have found another solution. I now have another span element with the first letter of that part in, and I cramp the full text and the first letter in the same container, and animate the full text to
width: 0;
:
It doesn't look perfect yet, I still need to fiddle with the end width, and the alignment of the text
https://codepen.io/NeilVanGotham/pen/zxOdZZMdont know what kind of effect you're going for, but this could be another way
https://codepen.io/MarkBoots/pen/PwYKmKe
That is exactly what I am looking for, thank you!
great! please mark/tag this question as
solved
so others recognize you're satisfied with the resolve. thanks! 😁