import {AfterViewInit, Component} from "@angular/core";
import {animate, state, style, transition, trigger} from "@angular/animations";
@Component({
selector: 'action-point',
template: `
`,
animations: [
trigger('move', [
state('in', style({
transform: 'scale(1)',
opacity: 1
})),
state('out', style({
transform: 'scale(3)',
opacity: 0
})),
transition('in => out', animate('2s ease-out'))
]),
]
})
export class ActionPointComponent implements AfterViewInit {
state = 'in';
ngAfterViewInit() {
setTimeout(() => {
this.state = 'out';
}, 0);
}
onEnd(event) {
this.state = 'in';
if (event.toState === 'in') {
setTimeout(() => {
this.state = 'out';
}, 2000);
}
}
}