Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
bertelot

including html tags in text plugin commands

Go to solution Solved by Carl,

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

Hi,

if i include a simple html tag like <b> in my TextPlugin command, like this ...:

 

TweenLite.to(yourElement, 2, {text:"This is the <br>new</b> text", ease:Linear.easeNone});

 

the "new" text will be displayed bold, BUT for a short period of time the <b> and </b> tag is visible (before it disappears).

 

Is there a way to make html tags NOT be visible?

 

Thank you!

Link to comment
Share on other sites

  • Solution

Sorry, the TextPlugin does not support nested html tags like <b>, <strong>, <em> etc. It only works on straight text.

 

You can create two text elements and tween them separately like so:

 

var tl = new TimelineLite();


tl.to("span.normal", 1, {text:"welcome to the "})
  .to("span.bold", 1, {text:"BOLD TEXT "})
  .timeScale(2);

 

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

  • 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.
×