Jump to content
Search Community

Not Animating

Susan 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 am very sorry, my Javascript knowledge is shallow.


Do you mean to replace this code


TweenMax.to(".logo", 2, {left:600});



TweenMax.to(".logo", 2, {left:600});


in the main.js file?


I have done the replacement but it is still not working.


Please assist further, apology for my ignorance, thanks.

Link to comment
Share on other sites

Hello @Susan and Welcome to the GreenSock Forum!


Just to add to @Sahil's great advice.


Using his code i would make one small change. convert left to x (translateX). This way you are using CSS transforms which can animate smoother versus CSS position offsets that can trigger layout on each render tick.


//wait until DOM is ready
document.addEventListener("DOMContentLoaded", function(event) {  
  // wait until window is loaded - all images, links, css, scripts, fonts, and other media assets
  window.addEventListener("load", function(){ 
       // run animation code here
       TweenMax.to(".logo", 2, {x:600});


More info on why this better found here:

The window load event makes sure that your logo which i presume is an image is only animated when the DOM is ready (HTML markup), and the window is loaded.  Meaning only run your code to animate the image when both DOM and window is loaded so your animation fires consistently cross browser.


Happy Tweening! :)

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