8000 How to flash · Issue #16 · jiayihu/ng-animate · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

How to flash #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
shan75 opened this issue Sep 25, 2018 · 3 comments
Open

How to flash #16

shan75 opened this issue Sep 25, 2018 · 3 comments

Comments

@shan75
Copy link
shan75 commented Sep 25, 2018

Hi
This is not an issue, but I want to use the basic flash , but it flashes only two times. I want to flash n times. How to do that? Also I want to trigger the flash by some action. How to achieve it?

Can you please explain

Thanks

@jiayihu
Copy link
Owner
jiayihu commented Sep 25, 2018

Unfortunately it's not possible to configure the number of flashes, but here is the animation if you want to copy and customize it to have more than 2 flashes:

export const flash = animation(
  animate(
    '{{ timing }}s {{ delay }}s',
    keyframes([
      style({ opacity: 1 }),
      style({ opacity: 0 }),
      style({ opacity: 1 }),
      style({ opacity: 0 }),
      style({ opacity: 1 }),
    ])
  ),
  { params: { timing: DEFAULT_TIMING, delay: 0 } }
);

About the trigger, you must define the action in the transition. For instance, with the following code, the animation wil be triggered when the flash property changes from stateA to stateB aka this.flash = 'stateB':

animations: [
    trigger('flash', [transition('stateA => stateB', useAnimation(flash))])
]

@shan75
Copy link
Author
shan75 commented Sep 26, 2018 via email

@shan75
Copy link
Author
shan75 commented Sep 26, 2018

Hi Thanks for the details.
I am not able to set the key frames as you have explained, I am very new to angular 4 and, it is not working for me. I have managed to get the animation work based on state. But I am not able to repeat 5 times. Can you please advice. Sorry for trouble
Thanks

animations: [
trigger('flash', [
state('small', style({ opacity: 1})),
state('large', style({ opacity: 0})),
transition('small => large', useAnimation(flash,
{ params: { timing: 5, delay: 1 }
}))
])
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0