Created
November 1, 2019 22:49
-
-
Save jenweber/6f33ffdc55e35b4e1dc8d80f2ff2e4ac to your computer and use it in GitHub Desktop.
Multiple ember-animated beacons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from '@glimmer/component'; | |
import { action } from '@ember/object'; | |
import { tracked } from '@glimmer/tracking'; | |
import scale from 'ember-animated/motions/scale'; | |
import move from 'ember-animated/motions/move'; | |
export default class HintComponent extends Component { | |
@tracked showHint = false; | |
@action | |
toggleHint() { | |
this.showHint = !this.showHint | |
} | |
* transition ({ insertedSprites, keptSprites, removedSprites, beacons }) { | |
for (let sprite of insertedSprites) { | |
let beaconName = sprite.element.dataset.beacon | |
sprite.startAtSprite(beacons[beaconName]); | |
move(sprite); | |
scale(sprite); | |
} | |
for (let sprite of keptSprites) { | |
move(sprite); | |
scale(sprite); | |
} | |
for (let sprite of removedSprites) { | |
let beaconName = sprite.element.dataset.beacon | |
sprite.endAtSprite(beacons[beaconName]); | |
move(sprite); | |
scale(sprite); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment