Jump to content
Search Community

TimelineLight endTime() keeps in increasing

colouredFunk 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'm using GSAP with TypeScript, and every time I load the page with TimelineLight on .endTime() keeps on increasing, I'm presuming this is because it's not getting disposed of correctly.

 

I've tried all of the following 

 

ngOnDestroy() {
    console.log("PAGE DESTROY")
    TweenMax.killAll();
    this.tl.clear();
    this.tl.remove();
    this.tl.invalidate();
    this.tl.kill();
    this.tl = null;
  }

 

 

This is the code I'm using to run the animation

  ngOnInit() {
    let speed = 0.75;
    let hold = 2;
    this.tl.addLabel('listen');
    this.tl.to(this.step1.nativeElement, speed, {'margin-left': 0, opacity: 1});
    this.tl.to(this.step1.nativeElement, speed, {'margin-left': -100, opacity: 0}, '+=' + hold);
    this.tl.addLabel('discover');
    this.tl.to(this.step2.nativeElement, speed, {'margin-left': 0, opacity: 1});
    this.tl.to(this.step2.nativeElement, speed, {'margin-left': -100, opacity: 0}, '+=' + hold);
    this.tl.addLabel('create');
    this.tl.to(this.step3.nativeElement, speed, {'margin-left': 0, opacity: 1});
    this.tl.to(this.step3.nativeElement, speed, {'margin-left': -100, opacity: 0}, '+=' + hold);
    this.tl.addLabel('launch');
    this.tl.to(this.step4.nativeElement, speed, {'margin-left': 0, opacity: 1});
    this.tl.to(this.step4.nativeElement, speed, {'margin-left': -100, opacity: 0}, '+=' + hold);
    this.tl.addLabel('care');
    this.tl.to(this.step5.nativeElement, speed, {'margin-left': 0, opacity: 1});

    this.totalTime = this.tl.endTime();
    console.log('this.tl.totalTime()' + this.tl.totalTime());
    console.log('this.tl.endTime()' + this.tl.endTime());

  }

 

Link to comment
Share on other sites

I thought endTime() was the value we entered into the Project Splinter time machine so we can splinter out to a new time/location and battle the Army of the 12 Monkeys to prevent the plague. ?

 

Just a little sci-fi geek humor/reference for anyone else watching 12 Monkeys on Syfy. ?

Link to comment
Share on other sites

4 minutes ago, PointC said:

I thought endTime() was the value we entered into the Project Splinter time machine so we can splinter out to a new time/location and battle the Army of the 12 Monkeys to prevent the plague.

 

I'll work on that for version 3.0. Still researching time travel algorithms. Kinda sick of cleaning up after these monkeys though. Sheesh. 

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