Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FrameAnimation does not created a paused timeline by default #2

Open
mirkovw opened this issue Feb 11, 2022 · 3 comments
Open

FrameAnimation does not created a paused timeline by default #2

mirkovw opened this issue Feb 11, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@mirkovw
Copy link
Contributor

mirkovw commented Feb 11, 2022

So it doesn't matter whether we wait until fonts/images are loaded because the timeline plays instantly, regardless.

@mirkovw mirkovw self-assigned this Feb 11, 2022
@mirkovw mirkovw added the bug Something isn't working label Feb 11, 2022
@mm-paulie mm-paulie self-assigned this Apr 15, 2022
@mirkovw
Copy link
Contributor Author

mirkovw commented May 18, 2022

@mm-paulie what was the PR that fixed this? Just found this issue in Ana's project again, wondering when it got fixed

@mirkovw mirkovw reopened this May 18, 2022
@mirkovw
Copy link
Contributor Author

mirkovw commented May 18, 2022

I checked that project with temple 6.2.2 and noticed the issue is still happening.. reopening this issue

@mm-paulie
Copy link
Contributor

mm-paulie commented Oct 10, 2022

It first runs the init function async, then it creates the animation and pauses it by default? Can you show me an example project where this happens?
In main.js

const banner = new Banner(config);
//first load fonts, load images etc in the init animation
banner.init().then(
  () => {
    //initializes animation and creates main timeline
    banner.setAnimation(new Animation(document.querySelector('.banner'), config));
    //plays banner
    banner.start()
  }
)

In Banner.js

async init() {
    this.banner = document.body.querySelector('.banner');
    await politeLoadImages(this.banner)
    await this.loadFonts(); //need to wait until fonts are loaded. Otherwise we will run fitText on the wrong fonts

    const title = document.body.querySelector('.title');
    const ctaCopy = document.body.querySelector('.cta_copy');
    fitText([title, ctaCopy]);

    this.domMainExit = document.body.querySelector('.mainExit');

    this.domMainExit.addEventListener('click', this.handleClick);
    this.domMainExit.addEventListener('mouseover', this.handleRollOver);
    this.domMainExit.addEventListener('mouseout', this.handleRollOut);
  }  

setAnimation(animation){
    this.animation = animation;
    //creates new timeline and pauses it
    this.animation.getTimeline().paused(true);
    // this.animation.getTimeline().eventCallback('onComplete', this.handleAnimationComplete);
  }

So first it loads the images/fonts and when that is done it creates the animation and pauses it by default?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants