Jump to content
Search Community

Use splitText with some other delimiter instead of a space?

Matt Hoover test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I need to create an animation of words forming a long hashtag. Is there an easy way to use another character as a delimiter besides a physical space to separate words, but have it animate in without any spaces?

 

I want to animate the words of something like "ThisIsAReallyLongHashtagExample" one word at a time, with no spaces.

 

Obviously I can't use spaces as a delimiter, but is there something else I can insert between words to let splitText know where to chop it up?

 

thanks for any insight!

 

- matt

Link to comment
Share on other sites

Based on your request, I updated SplitText to recognize a new "wordDelimiter" property that you can set to any character and it'll remove that character from the final output and just use it as a delimiter for words. For example: 

var split = new SplitText("#someID", {wordDelimiter:"#", wordsClass:"word++"});

That way, you can just drop "#" inbetween the chunks you want and it'll separate them as words. 

 

You can test it out on codepen using this URL: https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/SplitText.min.js (only works on codepen). Please let me know if it holds up well in your tests and then I can drop it into the official packages. 

  • Like 5
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...