loganliffick / splt

A text splitter that just f*cking works 🎊
https://spltjs.com
MIT License
235 stars 6 forks source link

Split by line? #2

Open jesserosenfield opened 2 years ago

jesserosenfield commented 2 years ago

Thanks for the awesome plugin!

Would be awesome to include support for splitting text by line.

Many thanks

loganliffick commented 2 years ago

Thanks for the kind words, Jesse!

I've had a few ideas around splitting between different layouts: characters (the basis of the V1 build), words, and lines.

The issue I've had when calculating for lines is responsiveness of a page breaking the animation. Splt takes what's initially rendered as text and spits back out the same render as individual characters which is totally fine from a responsive standpoint given you can resize the page and those characters will break line accordingly, however once you start playing around with lines as the basis —as opposed to characters, resizing creates some weird effects. From what I've seen, all of the other text-splitting libraries (splitting, and gsap) run into the same issue.

Definitely working on a fix, but for now in V1.1.0 you can target a line's characters individually to mimic line splitting. Not optimal for larger pieces of text, I know, but it does work until I'm able to solve for the line problem.

Thanks again for using splt!