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

Animated sidebar #205

Open
Subaku opened this issue Apr 2, 2020 · 1 comment
Open

Animated sidebar #205

Subaku opened this issue Apr 2, 2020 · 1 comment

Comments

@Subaku
Copy link

Subaku commented Apr 2, 2020

Question in trying to learn this wonderful addon. Got a sidebar that I'm animated in/out of the view which shoves the content to the right of it over as need be. My question is whether or not I'm doing it correctly as the animation of the content that gets moved over isn't smooth.

Apr-02-2020 08-36-40

An abbreviated version of my template around this:

<AnimatedContainer>
  {{#animated-if this.showFilters use=this.slideFromLeft duration=750}}
      <AssetLocations::Filters ...>
  {{/animated-if}}
</AnimatedContainer>
<div class="other-content">...</div>

Then my "use" function for the animation:

slideFromLeft = function * ({ insertedSprites, keptSprites, removedSprites }) {
  insertedSprites.forEach(sprite => {
    sprite.startAtPixel({ x: -400 });
    sprite.applyStyles({ 'z-index': '1' });
    move(sprite, { easing: easeIn });
  });

  removedSprites.forEach(sprite => {
    sprite.applyStyles({ 'z-index': '1' });
    sprite.endAtPixel({ x: -400 });
    move(sprite, { easing: easeOut });
  });
}

Figured using transitions is what's appropriate. Just unsure if I'm handing the animation correctly.
Any tips is appreciated!

@ef4
Copy link
Contributor

ef4 commented Apr 13, 2020

Are you deliberately allowing the original content to reflow? That is hard to make smooth and performant.

The alternative is to fix its width so it doesn't reflow, and instead either gets pushed partway off screen or gets scaled down via CSS transform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants