Jump to content
Search Community

TextPlugin error :|

AndryGinger 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

Hello.


I goes on following page: https://greensock.com/docs/Plugins/TextPlugin
And tried to use animation with text. But what I got:

Test cases:
  var yourElement = document.getElementById('quest-begin');

  TweenLite.to(yourElement, 2, {text: { value: 'HELLO!', newClass:"class2", oldClass:"class1"}, ease:Power2.easeIn});
  TweenLite.to(yourElement, 2, { scrambleText: { chars: "0123456789", ease: Linear.easeNone}}, "label+=" + 1*0.2);
  TweenMax.to(yourElement, 2, {text:"hello"});
  TweenLite.to(yourElement, 1, {text:{value:"shorter new text", padSpace:true}});

Test case errors:
  invalid text tween value: [object Object]
  invalid scrambleText tween value: [object Object]
  invalid text tween value: hello
  invalid text tween value: [object Object]

What's wrong? It's simple but not works. Help please.

See the Pen xQqzLq by andryginger (@andryginger) on CodePen

Link to comment
Share on other sites

You need to load the Text and ScrambleText plugins.
 

<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/plugins/TextPlugin.min.js"></script>
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/ScrambleTextPlugin.min.js"></script>

 

You'll also probably want to to move those tweens to a timeline if you want them to play in sequence using the position parameter.

 

Happy tweening.

:)

 

  • Like 5
  • Thanks 1
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...