Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add example that exports a part of an animation for reuse (#42321)
- Loading branch information
Showing
3 changed files
with
31 additions
and
13 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
// #docregion | ||
import { animation, style, animate } from '@angular/animations'; | ||
// #docplaster | ||
// #docregion animation-const, trigger-const | ||
import { animation, style, animate, trigger, transition, useAnimation } from '@angular/animations'; | ||
// #enddocregion trigger-const | ||
|
||
export const transAnimation = animation([ | ||
export const transitionAnimation = animation([ | ||
style({ | ||
height: '{{ height }}', | ||
opacity: '{{ opacity }}', | ||
backgroundColor: '{{ backgroundColor }}' | ||
}), | ||
animate('{{ time }}') | ||
]); | ||
// #enddocregion animation-const | ||
|
||
// #docregion trigger-const | ||
export const triggerAnimation = trigger('openClose', [ | ||
transition('open => closed', [ | ||
useAnimation(transitionAnimation, { | ||
params: { | ||
height: 0, | ||
opacity: 1, | ||
backgroundColor: 'red', | ||
time: '1s' | ||
} | ||
}) | ||
]) | ||
]); | ||
// #enddocregion trigger-const |
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
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