-
Notifications
You must be signed in to change notification settings - Fork 0
add year-of-moo-animation App #6
Comments
ng generate app year-of-moo-animation --skip-tests --style=scss --dry-run
ng generate component components/index --flat=false --module=app --project=year-of-moo-animation --spec=false --styleext=scss --dry-run
ng generate component components/use-animation --flat=false --module=app --project=year-of-moo-animation --spec=false --styleext=scss --dry-run
ng generate component components/animation-builder --flat=false --module=app --project=year-of-moo-animation --spec=false --styleext=scss --dry-run |
to switch apps for ng config defaultProject to set the value: ng config defaultProject year-of-moo-animation |
not managing players properly :( |
i've noticed that @matsko never uses when @matsko uses the term reusable he is almost always referring to reusable |
the |
this is the pattern that is working: slideBack(): void {
this.photos.forEach(img => {
const player = this.getImgPlayer(slideBackAnimation, img);
player.play();
});
}
slideForward(): void {
this.photos.forEach(img => {
const player = this.getImgPlayer(slideForwardAnimation, img);
player.play();
});
} previously, i tried to store my concern however is that these local instances of player might be stacking up in memory; i thought i was being clever by doing this:
but this throws errors likely due to race conditions (then there is a temptation to delay the call with something like |
this 'game' is working: player.onDone(() => {
console.log(`player ${player['id']} done`, player);
setTimeout(() => player.destroy(), 500);
}); however, the final animation state is destroyed when the player is destroyed more context around the above: private getPlayer(
animationMetadata: AnimationReferenceMetadata,
el: Element
): AnimationPlayer {
const factory = this.animationBuilder.build(animationMetadata);
const x = el.clientWidth / 2;
const player = factory.create(el, { params: { x: x } });
player.onDestroy(() => console.log(`player ${player['id']} destroyed`));
player.onDone(() => {
console.log(`player ${player['id']} done`, player);
setTimeout(() => player.destroy(), 500);
});
return player;
} |
quick look at the this move does not pop the element back to where it started the animation on Edge—on Chrome it is fine: player.onDone(() => {
console.log(`player ${player['id']} done`, player);
setTimeout(() => player.reset(), 500);
}); this is telling me, i need to resolve #8 |
for this particular example the goal post will be moved to show both of these scenarios:
the latter scenario is important when |
this approach is not working: slideDivBack(): void {
const player = this.simpleBlockAnimationMeta.slideBackPlayer;
if (player.hasStarted()) {
player.reset();
}
player.play();
}
slideDivForward(): void {
const player = this.simpleBlockAnimationMeta.slideForwardPlayer;
if (player.hasStarted()) {
player.reset();
}
player.play();
} |
another approach: exclusively address the concern of using an animation player once (and destroying it before it is replaced) the arguments passed to the catch is around generating the unique ID |
continuing on from #4, the two subtopics should be covered immediately:
The text was updated successfully, but these errors were encountered: