Jump to content
Search Community

exportRoot QA

tailbreezy test
Moderator Tag

Recommended Posts

var tl = gsap.timeline()
.to('.box', { x: 200})

console.log(gsap.globalTimeline.duration()) // ~1.281
 
console.log(gsap.exportRoot().duration()) // ~1.281

console.log(tl.duration()) // 0.5

I wonder where the extra 0.70-0.80s come from in exportRoot and globalTimeline.

See the Pen 638b1c9b5c499e1e455e8f7247943835?editors=1111 by dadacoded (@dadacoded) on CodePen

Link to comment
Share on other sites

  • tailbreezy changed the title to exportRoot QA


If that is true. It seems it gets initialized the moment the gsap script is loaded. Since setting timelines after load results in the same.
 


window.addEventListener('load', () => {

  var tl = gsap.timeline()
  .to('.box', { x: 200})

  console.log(gsap.globalTimeline.duration()) // ~1.281

  console.log(gsap.exportRoot().duration()) // ~1.281

  console.log(tl.duration()) // 0.5
  
})

 

Link to comment
Share on other sites

Yup.

 

window.addEventListener("load", () => {
  function loadScript(src) {
    return new Promise(function (resolve, reject) {
      var s;
      s = document.createElement("script");
      s.src = src;
      s.onload = resolve;
      s.onerror = reject;
      document.head.appendChild(s);
    });
  }

  loadScript("https://unpkg.co/gsap@3/dist/gsap.min.js").then(() => {
    var tl = gsap.timeline().to(".box", { x: 200 });

    console.log(gsap.globalTimeline.duration()); // 0.5

    console.log(gsap.exportRoot().duration()); // 0.5

    console.log(tl.duration()); // 0.5
  });
});

 

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