Jump to content
Search Community

Chrome reload bug

PaulTheSwissGuy test
Moderator Tag

Recommended Posts

Hello people !

I made a simple .to tween, it's actually working if I open my live server and arrive on  a new page.

But I soon as I change my JavaScript, the tween is tweening from the middle of its animation, and not from the beginning, it's very frustrating.


It was not happening before, this is kinda new.
I made a video for you : https://www.youtube.com/watch?v=VWO7RofzSoE
 

I'm coding with VS Code, with the live server extension + autosave on.

 

The code is dead simple :
 

HTML :    
<div class="cube"></div>

CSS :
.cube {
    background-colororangered;
    width300px;
    height300px;
}
JS :
const cube = document.querySelector(".cube")
gsap.to(cube, { duration: 2x: 300 });
Link to comment
Share on other sites

This seems like it's a dev env issue due to hot reloading and not a gsap issue, and I can't imagine it'll show up in produciton. If you want the animation to start from the beginning, you'll likely want to make a function that plays the timeline/tween from 0, or kills and resets the tween on refresh. Otherwise, you can use .fromTo to avoid this.

  • Like 2
Link to comment
Share on other sites

1 hour ago, PaulTheSwissGuy said:

How do you preview your animations with VS Code guys ?
You are not using the Live Server for simple projects ?

Nope. Save and refresh. 

 

1 hour ago, PaulTheSwissGuy said:

There is no solution at all ?

There might be, but not related to GSAP specifically. It's not an issue with GSAP.

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