Jump to content
Search Community

TweenLite.to won't change my text.

jimeast 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

It's about the simplest example possible and it's got me stumped.  When I run at home I always get a "TweenLite is not defined" error.

 

This is copied from my editor at home.

<body>

<div id="text1">Eat</div>

<script https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/TweenLite.min.js></script>
<script>
  var txt = document.getElementById("text1").innerText;
  TweenLite.to(txt, 2, {text:"New text here"});
  console.log(txt);
</script>
</body>

See the Pen YJgrBr?editors=1111 by jimeast (@jimeast) on CodePen

Link to comment
Share on other sites

Great!!  This works on codepen now if I can get it to work elsewhere.  

This is the entire code just so we know I'm not missing something.

 

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Eat More Chowder</title>
  <style> body { background-color: #ccc; } </style>
</head>

<body> 
<div id="text1">Eat</div>

<script https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/TweenLite.min.js></script>
<script https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/plugins/TextPlugin.min.js></script>

<script>
var txt = document.getElementById("text1");
TweenLite.to(txt, 2, {text:"New text here"});
  console.log(txt);
</script>
</body>
</html>

Every time I run I get this error:  Uncaught ReferenceError: TweenLite is not defined
    at eatMore.html:24      What am I doing wrong?

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