Skip to content

Commit

Permalink
Add animation for favorites filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieTheWagner committed Dec 22, 2019
1 parent 23818a6 commit ed23352
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/components/palettes-list.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="palettes-list">
{{#each @palettes as |palette|}}
<AnimatedContainer class="palettes-list">
{{#animated-each @palettes use=this.transition as |palette|}}
<PaletteRow
@moveColorsBetweenPalettes={{@moveColorsBetweenPalettes}}
@palette={{palette}}
/>
{{/each}}
</div>
{{/animated-each}}
</AnimatedContainer>
16 changes: 16 additions & 0 deletions app/components/palettes-list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
import Component from '@glimmer/component';
import { fadeOut } from 'ember-animated/motions/opacity';
import move from 'ember-animated/motions/move';

export default class PalettesListComponent extends Component {
*transition({ keptSprites, insertedSprites, removedSprites }) {
for (let sprite of insertedSprites) {
sprite.startTranslatedBy(0, -sprite.finalBounds.height / 2);
move(sprite);
}

for (let sprite of keptSprites) {
move(sprite);
}

for (let sprite of removedSprites) {
fadeOut(sprite);
}
}
}

0 comments on commit ed23352

Please sign in to comment.