How to add an angular aniamtions with parameters from ... component.ts? [closed]

1

I know how to add animations with parametres from HTML, as follows:

Animations.ts

    trigger('slowXMove', [
        state('posX1State', style({
            left: '{{posX1}}px'
        }), {params: {posX1: '0px'}}),
        state('posX2State', style({
            left: '{{posX1}}px'
        }), {params: {posX1: '0px'}}),
        transition('posX1State => posX2State', animate('2s')),
        transition('posX2State => posX1State', animate('2s'))
    ])

HTML

<img [@slowXMove]="{value: stateX, params: {posX1: posXImg1}}" ...

Now I need to do same but from component.ts. I know how to do without without parametres, as follows:

@HostBinding('@myanimation') state= 'state1';

But, how can I agree Parametres to my animation from component.ts?

    
asked by esobrinoz 04.09.2018 в 09:59
source

1 answer

-2

Great !! Finally I got how to solve it.

In component.ts     @HostBinding ('@ myAnimation') animationObj;     builder(...) {         this.scrollAnimation = {           value: 'state1',           params: {              duration: '1s ease-in', transform: '0px'           }         };     }

Thanks !! I hope it to be usefull for you!

    
answered by 04.09.2018 в 10:48