Jump to content
Search Community

SplitText removes spaces

anteksiler 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 just upgraded my membership to get access to SplitText. However, I cannot get it maintain the spaces between words.

 

I am using basic configuration:

var splith1 = new SplitText(h1, {
					    type: "chars"
					  }),
				    tl = new TimelineMax(),
				    splith1Array = base.randomize(splith1.chars);

tl.staggerFrom(splith1Array, 0.5, {
				  autoAlpha: 0,
				  y: "100%"
				}, 0.1);

It can also be seen on default GS demos: 

See the Pen pbWwLZ by GreenSock (@GreenSock) on CodePen

Link to comment
Share on other sites

Hello anteksiler, and Welcome to the GreenSock forum!

 

Sorry you having trouble! I contacted Jack about this, please standby!

 

Do you have an example of what you have tried so we can see your code example in context?

 

Also make sure you are using version 1.19.0 and replace the word latest with 1.9.0 if you are using the TweenMax.min.js your script url.

 

Here is a video tut on how to create a codepen example.

 

 

This way we can test your code live on codepen.

 

Thanks!

:)

  • Like 2
Link to comment
Share on other sites

Hm, I'm kinda confused. That codepen you linked to seems to work perfectly. I must be missing something. Like Jonathan said, it'd really help if you could provide a reduced test case so we can see things in context and identify what's going awry. 

 

Hi there, I forked that demo and only removed wordDelimiter: "*" option:

 

See the Pen qNvRwj by anteksiler (@anteksiler) on CodePen

Link to comment
Share on other sites

hmm, I think the wordDelimiter might be confusing things. That property is for a very rare edge-case where you want to use a special character other than a natural space to denote where words should be split and not have any space between them.

 

SplitText automatically detects the spaces in the text that you want to split into words.

http://codepen.io/GreenSock/pen/EyrWYk?editors=1010

 

Does that help?

  • Like 4
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...