a zip code crypto-currency system good for red ONLY

animations.js 47KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510
  1. /**
  2. * @license Angular v5.2.11
  3. * (c) 2010-2018 Google, Inc. https://angular.io/
  4. * License: MIT
  5. */
  6. /**
  7. * @fileoverview added by tsickle
  8. * @suppress {checkTypes} checked by tsc
  9. */
  10. /**
  11. * AnimationBuilder is an injectable service that is available when the {\@link
  12. * BrowserAnimationsModule BrowserAnimationsModule} or {\@link NoopAnimationsModule
  13. * NoopAnimationsModule} modules are used within an application.
  14. *
  15. * The purpose if this service is to produce an animation sequence programmatically within an
  16. * angular component or directive.
  17. *
  18. * Programmatic animations are first built and then a player is created when the build animation is
  19. * attached to an element.
  20. *
  21. * ```ts
  22. * // remember to include the BrowserAnimationsModule module for this to work...
  23. * import {AnimationBuilder} from '\@angular/animations';
  24. *
  25. * class MyCmp {
  26. * constructor(private _builder: AnimationBuilder) {}
  27. *
  28. * makeAnimation(element: any) {
  29. * // first build the animation
  30. * const myAnimation = this._builder.build([
  31. * style({ width: 0 }),
  32. * animate(1000, style({ width: '100px' }))
  33. * ]);
  34. *
  35. * // then create a player from it
  36. * const player = myAnimation.create(element);
  37. *
  38. * player.play();
  39. * }
  40. * }
  41. * ```
  42. *
  43. * When an animation is built an instance of {\@link AnimationFactory AnimationFactory} will be
  44. * returned. Using that an {\@link AnimationPlayer AnimationPlayer} can be created which can then be
  45. * used to start the animation.
  46. *
  47. * \@experimental Animation support is experimental.
  48. * @abstract
  49. */
  50. class AnimationBuilder {
  51. }
  52. /**
  53. * An instance of `AnimationFactory` is returned from {\@link AnimationBuilder#build
  54. * AnimationBuilder.build}.
  55. *
  56. * \@experimental Animation support is experimental.
  57. * @abstract
  58. */
  59. class AnimationFactory {
  60. }
  61. /**
  62. * @fileoverview added by tsickle
  63. * @suppress {checkTypes} checked by tsc
  64. */
  65. /**
  66. * @license
  67. * Copyright Google Inc. All Rights Reserved.
  68. *
  69. * Use of this source code is governed by an MIT-style license that can be
  70. * found in the LICENSE file at https://angular.io/license
  71. * @record
  72. */
  73. /**
  74. * \@experimental Animation support is experimental.
  75. */
  76. const AUTO_STYLE = '*';
  77. /**
  78. * \@experimental Animation support is experimental.
  79. * @record
  80. */
  81. /**
  82. * Metadata representing the entry of animations. Instances of this interface are provided via the
  83. * animation DSL when the {\@link trigger trigger animation function} is called.
  84. *
  85. * \@experimental Animation support is experimental.
  86. * @record
  87. */
  88. /**
  89. * Metadata representing the entry of animations. Instances of this interface are provided via the
  90. * animation DSL when the {\@link state state animation function} is called.
  91. *
  92. * \@experimental Animation support is experimental.
  93. * @record
  94. */
  95. /**
  96. * Metadata representing the entry of animations. Instances of this interface are provided via the
  97. * animation DSL when the {\@link transition transition animation function} is called.
  98. *
  99. * \@experimental Animation support is experimental.
  100. * @record
  101. */
  102. /**
  103. * \@experimental Animation support is experimental.
  104. * @record
  105. */
  106. /**
  107. * \@experimental Animation support is experimental.
  108. * @record
  109. */
  110. /**
  111. * Metadata representing the entry of animations. Instances of this interface are provided via the
  112. * animation DSL when the {\@link keyframes keyframes animation function} is called.
  113. *
  114. * \@experimental Animation support is experimental.
  115. * @record
  116. */
  117. /**
  118. * Metadata representing the entry of animations. Instances of this interface are provided via the
  119. * animation DSL when the {\@link style style animation function} is called.
  120. *
  121. * \@experimental Animation support is experimental.
  122. * @record
  123. */
  124. /**
  125. * Metadata representing the entry of animations. Instances of this interface are provided via the
  126. * animation DSL when the {\@link animate animate animation function} is called.
  127. *
  128. * \@experimental Animation support is experimental.
  129. * @record
  130. */
  131. /**
  132. * Metadata representing the entry of animations. Instances of this interface are provided via the
  133. * animation DSL when the {\@link animateChild animateChild animation function} is called.
  134. *
  135. * \@experimental Animation support is experimental.
  136. * @record
  137. */
  138. /**
  139. * Metadata representing the entry of animations. Instances of this interface are provided via the
  140. * animation DSL when the {\@link useAnimation useAnimation animation function} is called.
  141. *
  142. * \@experimental Animation support is experimental.
  143. * @record
  144. */
  145. /**
  146. * Metadata representing the entry of animations. Instances of this interface are provided via the
  147. * animation DSL when the {\@link sequence sequence animation function} is called.
  148. *
  149. * \@experimental Animation support is experimental.
  150. * @record
  151. */
  152. /**
  153. * Metadata representing the entry of animations. Instances of this interface are provided via the
  154. * animation DSL when the {\@link group group animation function} is called.
  155. *
  156. * \@experimental Animation support is experimental.
  157. * @record
  158. */
  159. /**
  160. * Metadata representing the entry of animations. Instances of this interface are provided via the
  161. * animation DSL when the {\@link stagger stagger animation function} is called.
  162. *
  163. * \@experimental Animation support is experimental.
  164. * @record
  165. */
  166. /**
  167. * `trigger` is an animation-specific function that is designed to be used inside of Angular's
  168. * animation DSL language. If this information is new, please navigate to the
  169. * {\@link Component#animations component animations metadata page} to gain a better
  170. * understanding of how animations in Angular are used.
  171. *
  172. * `trigger` Creates an animation trigger which will a list of {\@link state state} and
  173. * {\@link transition transition} entries that will be evaluated when the expression
  174. * bound to the trigger changes.
  175. *
  176. * Triggers are registered within the component annotation data under the
  177. * {\@link Component#animations animations section}. An animation trigger can be placed on an element
  178. * within a template by referencing the name of the trigger followed by the expression value that
  179. * the
  180. * trigger is bound to (in the form of `[\@triggerName]="expression"`.
  181. *
  182. * Animation trigger bindings strigify values and then match the previous and current values against
  183. * any linked transitions. If a boolean value is provided into the trigger binding then it will both
  184. * be represented as `1` or `true` and `0` or `false` for a true and false boolean values
  185. * respectively.
  186. *
  187. * ### Usage
  188. *
  189. * `trigger` will create an animation trigger reference based on the provided `name` value. The
  190. * provided `animation` value is expected to be an array consisting of {\@link state state} and
  191. * {\@link transition transition} declarations.
  192. *
  193. * ```typescript
  194. * \@Component({
  195. * selector: 'my-component',
  196. * templateUrl: 'my-component-tpl.html',
  197. * animations: [
  198. * trigger("myAnimationTrigger", [
  199. * state(...),
  200. * state(...),
  201. * transition(...),
  202. * transition(...)
  203. * ])
  204. * ]
  205. * })
  206. * class MyComponent {
  207. * myStatusExp = "something";
  208. * }
  209. * ```
  210. *
  211. * The template associated with this component will make use of the `myAnimationTrigger` animation
  212. * trigger by binding to an element within its template code.
  213. *
  214. * ```html
  215. * <!-- somewhere inside of my-component-tpl.html -->
  216. * <div [\@myAnimationTrigger]="myStatusExp">...</div>
  217. * ```
  218. *
  219. * ## Disable Animations
  220. * A special animation control binding called `\@.disabled` can be placed on an element which will
  221. * then disable animations for any inner animation triggers situated within the element as well as
  222. * any animations on the element itself.
  223. *
  224. * When true, the `\@.disabled` binding will prevent all animations from rendering. The example
  225. * below shows how to use this feature:
  226. *
  227. * ```ts
  228. * \@Component({
  229. * selector: 'my-component',
  230. * template: `
  231. * <div [\@.disabled]="isDisabled">
  232. * <div [\@childAnimation]="exp"></div>
  233. * </div>
  234. * `,
  235. * animations: [
  236. * trigger("childAnimation", [
  237. * // ...
  238. * ])
  239. * ]
  240. * })
  241. * class MyComponent {
  242. * isDisabled = true;
  243. * exp = '...';
  244. * }
  245. * ```
  246. *
  247. * The `\@childAnimation` trigger will not animate because `\@.disabled` prevents it from happening
  248. * (when true).
  249. *
  250. * Note that `\@.disabled` will only disable all animations (this means any animations running on
  251. * the same element will also be disabled).
  252. *
  253. * ### Disabling Animations Application-wide
  254. * When an area of the template is set to have animations disabled, **all** inner components will
  255. * also have their animations disabled as well. This means that all animations for an angular
  256. * application can be disabled by placing a host binding set on `\@.disabled` on the topmost Angular
  257. * component.
  258. *
  259. * ```ts
  260. * import {Component, HostBinding} from '\@angular/core';
  261. *
  262. * \@Component({
  263. * selector: 'app-component',
  264. * templateUrl: 'app.component.html',
  265. * })
  266. * class AppComponent {
  267. * \@HostBinding('\@.disabled')
  268. * public animationsDisabled = true;
  269. * }
  270. * ```
  271. *
  272. * ### What about animations that us `query()` and `animateChild()`?
  273. * Despite inner animations being disabled, a parent animation can {\@link query query} for inner
  274. * elements located in disabled areas of the template and still animate them as it sees fit. This is
  275. * also the case for when a sub animation is queried by a parent and then later animated using {\@link
  276. * animateChild animateChild}.
  277. *
  278. * \@experimental Animation support is experimental.
  279. * @param {?} name
  280. * @param {?} definitions
  281. * @return {?}
  282. */
  283. function trigger(name, definitions) {
  284. return { type: 7 /* Trigger */, name, definitions, options: {} };
  285. }
  286. /**
  287. * `animate` is an animation-specific function that is designed to be used inside of Angular's
  288. * animation DSL language. If this information is new, please navigate to the {\@link
  289. * Component#animations component animations metadata page} to gain a better understanding of
  290. * how animations in Angular are used.
  291. *
  292. * `animate` specifies an animation step that will apply the provided `styles` data for a given
  293. * amount of time based on the provided `timing` expression value. Calls to `animate` are expected
  294. * to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link
  295. * transition transition}.
  296. *
  297. * ### Usage
  298. *
  299. * The `animate` function accepts two input parameters: `timing` and `styles`:
  300. *
  301. * - `timing` is a string based value that can be a combination of a duration with optional delay
  302. * and easing values. The format for the expression breaks down to `duration delay easing`
  303. * (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000,
  304. * delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the
  305. * `duration` value in millisecond form.
  306. * - `styles` is the style input data which can either be a call to {\@link style style} or {\@link
  307. * keyframes keyframes}. If left empty then the styles from the destination state will be collected
  308. * and used (this is useful when describing an animation step that will complete an animation by
  309. * {\@link transition#the-final-animate-call animating to the final state}).
  310. *
  311. * ```typescript
  312. * // various functions for specifying timing data
  313. * animate(500, style(...))
  314. * animate("1s", style(...))
  315. * animate("100ms 0.5s", style(...))
  316. * animate("5s ease", style(...))
  317. * animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...))
  318. *
  319. * // either style() of keyframes() can be used
  320. * animate(500, style({ background: "red" }))
  321. * animate(500, keyframes([
  322. * style({ background: "blue" })),
  323. * style({ background: "red" }))
  324. * ])
  325. * ```
  326. *
  327. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  328. *
  329. * \@experimental Animation support is experimental.
  330. * @param {?} timings
  331. * @param {?=} styles
  332. * @return {?}
  333. */
  334. function animate(timings, styles = null) {
  335. return { type: 4 /* Animate */, styles, timings };
  336. }
  337. /**
  338. * `group` is an animation-specific function that is designed to be used inside of Angular's
  339. * animation DSL language. If this information is new, please navigate to the {\@link
  340. * Component#animations component animations metadata page} to gain a better understanding of
  341. * how animations in Angular are used.
  342. *
  343. * `group` specifies a list of animation steps that are all run in parallel. Grouped animations are
  344. * useful when a series of styles must be animated/closed off at different starting/ending times.
  345. *
  346. * The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition
  347. * transition} and it will only continue to the next instruction once all of the inner animation
  348. * steps have completed.
  349. *
  350. * ### Usage
  351. *
  352. * The `steps` data that is passed into the `group` animation function can either consist of {\@link
  353. * style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()`
  354. * within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link
  355. * animate#usage animate() with a delay value} to offset styles to be applied at a later time).
  356. *
  357. * ```typescript
  358. * group([
  359. * animate("1s", { background: "black" }))
  360. * animate("2s", { color: "white" }))
  361. * ])
  362. * ```
  363. *
  364. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  365. *
  366. * \@experimental Animation support is experimental.
  367. * @param {?} steps
  368. * @param {?=} options
  369. * @return {?}
  370. */
  371. function group(steps, options = null) {
  372. return { type: 3 /* Group */, steps, options };
  373. }
  374. /**
  375. * `sequence` is an animation-specific function that is designed to be used inside of Angular's
  376. * animation DSL language. If this information is new, please navigate to the {\@link
  377. * Component#animations component animations metadata page} to gain a better understanding of
  378. * how animations in Angular are used.
  379. *
  380. * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by
  381. * default when an array is passed as animation data into {\@link transition transition}.)
  382. *
  383. * The `sequence` function can either be used within a {\@link group group} or a {\@link transition
  384. * transition} and it will only continue to the next instruction once each of the inner animation
  385. * steps have completed.
  386. *
  387. * To perform animation styling in parallel with other animation steps then have a look at the
  388. * {\@link group group} animation function.
  389. *
  390. * ### Usage
  391. *
  392. * The `steps` data that is passed into the `sequence` animation function can either consist of
  393. * {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the
  394. * provided styling data immediately while a call to `animate()` will apply its styling data over a
  395. * given time depending on its timing data.
  396. *
  397. * ```typescript
  398. * sequence([
  399. * style({ opacity: 0 })),
  400. * animate("1s", { opacity: 1 }))
  401. * ])
  402. * ```
  403. *
  404. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  405. *
  406. * \@experimental Animation support is experimental.
  407. * @param {?} steps
  408. * @param {?=} options
  409. * @return {?}
  410. */
  411. function sequence(steps, options = null) {
  412. return { type: 2 /* Sequence */, steps, options };
  413. }
  414. /**
  415. * `style` is an animation-specific function that is designed to be used inside of Angular's
  416. * animation DSL language. If this information is new, please navigate to the {\@link
  417. * Component#animations component animations metadata page} to gain a better understanding of
  418. * how animations in Angular are used.
  419. *
  420. * `style` declares a key/value object containing CSS properties/styles that can then be used for
  421. * {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data
  422. * for both {\@link animate animate} and {\@link keyframes keyframes}.
  423. *
  424. * ### Usage
  425. *
  426. * `style` takes in a key/value string map as data and expects one or more CSS property/value pairs
  427. * to be defined.
  428. *
  429. * ```typescript
  430. * // string values are used for css properties
  431. * style({ background: "red", color: "blue" })
  432. *
  433. * // numerical (pixel) values are also supported
  434. * style({ width: 100, height: 0 })
  435. * ```
  436. *
  437. * #### Auto-styles (using `*`)
  438. *
  439. * When an asterix (`*`) character is used as a value then it will be detected from the element
  440. * being animated and applied as animation data when the animation starts.
  441. *
  442. * This feature proves useful for a state depending on layout and/or environment factors; in such
  443. * cases the styles are calculated just before the animation starts.
  444. *
  445. * ```typescript
  446. * // the steps below will animate from 0 to the
  447. * // actual height of the element
  448. * style({ height: 0 }),
  449. * animate("1s", style({ height: "*" }))
  450. * ```
  451. *
  452. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  453. *
  454. * \@experimental Animation support is experimental.
  455. * @param {?} tokens
  456. * @return {?}
  457. */
  458. function style(tokens) {
  459. return { type: 6 /* Style */, styles: tokens, offset: null };
  460. }
  461. /**
  462. * `state` is an animation-specific function that is designed to be used inside of Angular's
  463. * animation DSL language. If this information is new, please navigate to the {\@link
  464. * Component#animations component animations metadata page} to gain a better understanding of
  465. * how animations in Angular are used.
  466. *
  467. * `state` declares an animation state within the given trigger. When a state is active within a
  468. * component then its associated styles will persist on the element that the trigger is attached to
  469. * (even when the animation ends).
  470. *
  471. * To animate between states, have a look at the animation {\@link transition transition} DSL
  472. * function. To register states to an animation trigger please have a look at the {\@link trigger
  473. * trigger} function.
  474. *
  475. * #### The `void` state
  476. *
  477. * The `void` state value is a reserved word that angular uses to determine when the element is not
  478. * apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the
  479. * associated element is void).
  480. *
  481. * #### The `*` (default) state
  482. *
  483. * The `*` state (when styled) is a fallback state that will be used if the state that is being
  484. * animated is not declared within the trigger.
  485. *
  486. * ### Usage
  487. *
  488. * `state` will declare an animation state with its associated styles
  489. * within the given trigger.
  490. *
  491. * - `stateNameExpr` can be one or more state names separated by commas.
  492. * - `styles` refers to the {\@link style styling data} that will be persisted on the element once
  493. * the state has been reached.
  494. *
  495. * ```typescript
  496. * // "void" is a reserved name for a state and is used to represent
  497. * // the state in which an element is detached from from the application.
  498. * state("void", style({ height: 0 }))
  499. *
  500. * // user-defined states
  501. * state("closed", style({ height: 0 }))
  502. * state("open, visible", style({ height: "*" }))
  503. * ```
  504. *
  505. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  506. *
  507. * \@experimental Animation support is experimental.
  508. * @param {?} name
  509. * @param {?} styles
  510. * @param {?=} options
  511. * @return {?}
  512. */
  513. function state(name, styles, options) {
  514. return { type: 0 /* State */, name, styles, options };
  515. }
  516. /**
  517. * `keyframes` is an animation-specific function that is designed to be used inside of Angular's
  518. * animation DSL language. If this information is new, please navigate to the {\@link
  519. * Component#animations component animations metadata page} to gain a better understanding of
  520. * how animations in Angular are used.
  521. *
  522. * `keyframes` specifies a collection of {\@link style style} entries each optionally characterized
  523. * by an `offset` value.
  524. *
  525. * ### Usage
  526. *
  527. * The `keyframes` animation function is designed to be used alongside the {\@link animate animate}
  528. * animation function. Instead of applying animations from where they are currently to their
  529. * destination, keyframes can describe how each style entry is applied and at what point within the
  530. * animation arc (much like CSS Keyframe Animations do).
  531. *
  532. * For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what
  533. * percentage of the animate time the styles will be applied.
  534. *
  535. * ```typescript
  536. * // the provided offset values describe when each backgroundColor value is applied.
  537. * animate("5s", keyframes([
  538. * style({ backgroundColor: "red", offset: 0 }),
  539. * style({ backgroundColor: "blue", offset: 0.2 }),
  540. * style({ backgroundColor: "orange", offset: 0.3 }),
  541. * style({ backgroundColor: "black", offset: 1 })
  542. * ]))
  543. * ```
  544. *
  545. * Alternatively, if there are no `offset` values used within the style entries then the offsets
  546. * will be calculated automatically.
  547. *
  548. * ```typescript
  549. * animate("5s", keyframes([
  550. * style({ backgroundColor: "red" }) // offset = 0
  551. * style({ backgroundColor: "blue" }) // offset = 0.33
  552. * style({ backgroundColor: "orange" }) // offset = 0.66
  553. * style({ backgroundColor: "black" }) // offset = 1
  554. * ]))
  555. * ```
  556. *
  557. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  558. *
  559. * \@experimental Animation support is experimental.
  560. * @param {?} steps
  561. * @return {?}
  562. */
  563. function keyframes(steps) {
  564. return { type: 5 /* Keyframes */, steps };
  565. }
  566. /**
  567. * `transition` is an animation-specific function that is designed to be used inside of Angular's
  568. * animation DSL language. If this information is new, please navigate to the {\@link
  569. * Component#animations component animations metadata page} to gain a better understanding of
  570. * how animations in Angular are used.
  571. *
  572. * `transition` declares the {\@link sequence sequence of animation steps} that will be run when the
  573. * provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 =>
  574. * state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting
  575. * and/or ending state).
  576. *
  577. * A function can also be provided as the `stateChangeExpr` argument for a transition and this
  578. * function will be executed each time a state change occurs. If the value returned within the
  579. * function is true then the associated animation will be run.
  580. *
  581. * Animation transitions are placed within an {\@link trigger animation trigger}. For an transition
  582. * to animate to a state value and persist its styles then one or more {\@link state animation
  583. * states} is expected to be defined.
  584. *
  585. * ### Usage
  586. *
  587. * An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on
  588. * what the previous state is and what the current state has become. In other words, if a transition
  589. * is defined that matches the old/current state criteria then the associated animation will be
  590. * triggered.
  591. *
  592. * ```typescript
  593. * // all transition/state changes are defined within an animation trigger
  594. * trigger("myAnimationTrigger", [
  595. * // if a state is defined then its styles will be persisted when the
  596. * // animation has fully completed itself
  597. * state("on", style({ background: "green" })),
  598. * state("off", style({ background: "grey" })),
  599. *
  600. * // a transition animation that will be kicked off when the state value
  601. * // bound to "myAnimationTrigger" changes from "on" to "off"
  602. * transition("on => off", animate(500)),
  603. *
  604. * // it is also possible to do run the same animation for both directions
  605. * transition("on <=> off", animate(500)),
  606. *
  607. * // or to define multiple states pairs separated by commas
  608. * transition("on => off, off => void", animate(500)),
  609. *
  610. * // this is a catch-all state change for when an element is inserted into
  611. * // the page and the destination state is unknown
  612. * transition("void => *", [
  613. * style({ opacity: 0 }),
  614. * animate(500)
  615. * ]),
  616. *
  617. * // this will capture a state change between any states
  618. * transition("* => *", animate("1s 0s")),
  619. *
  620. * // you can also go full out and include a function
  621. * transition((fromState, toState) => {
  622. * // when `true` then it will allow the animation below to be invoked
  623. * return fromState == "off" && toState == "on";
  624. * }, animate("1s 0s"))
  625. * ])
  626. * ```
  627. *
  628. * The template associated with this component will make use of the `myAnimationTrigger` animation
  629. * trigger by binding to an element within its template code.
  630. *
  631. * ```html
  632. * <!-- somewhere inside of my-component-tpl.html -->
  633. * <div [\@myAnimationTrigger]="myStatusExp">...</div>
  634. * ```
  635. *
  636. * #### The final `animate` call
  637. *
  638. * If the final step within the transition steps is a call to `animate()` that **only** uses a
  639. * timing value with **no style data** then it will be automatically used as the final animation arc
  640. * for the element to animate itself to the final state. This involves an automatic mix of
  641. * adding/removing CSS styles so that the element will be in the exact state it should be for the
  642. * applied state to be presented correctly.
  643. *
  644. * ```
  645. * // start off by hiding the element, but make sure that it animates properly to whatever state
  646. * // is currently active for "myAnimationTrigger"
  647. * transition("void => *", [
  648. * style({ opacity: 0 }),
  649. * animate(500)
  650. * ])
  651. * ```
  652. *
  653. * ### Using :enter and :leave
  654. *
  655. * Given that enter (insertion) and leave (removal) animations are so common, the `transition`
  656. * function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `*
  657. * => void` state changes.
  658. *
  659. * ```
  660. * transition(":enter", [
  661. * style({ opacity: 0 }),
  662. * animate(500, style({ opacity: 1 }))
  663. * ]),
  664. * transition(":leave", [
  665. * animate(500, style({ opacity: 0 }))
  666. * ])
  667. * ```
  668. *
  669. * ### Boolean values
  670. * if a trigger binding value is a boolean value then it can be matched using a transition
  671. * expression that compares `true` and `false` or `1` and `0`.
  672. *
  673. * ```
  674. * // in the template
  675. * <div [\@openClose]="open ? true : false">...</div>
  676. *
  677. * // in the component metadata
  678. * trigger('openClose', [
  679. * state('true', style({ height: '*' })),
  680. * state('false', style({ height: '0px' })),
  681. * transition('false <=> true', animate(500))
  682. * ])
  683. * ```
  684. *
  685. * ### Using :increment and :decrement
  686. * In addition to the :enter and :leave transition aliases, the :increment and :decrement aliases
  687. * can be used to kick off a transition when a numeric value has increased or decreased in value.
  688. *
  689. * ```
  690. * import {group, animate, query, transition, style, trigger} from '\@angular/animations';
  691. * import {Component} from '\@angular/core';
  692. *
  693. * \@Component({
  694. * selector: 'banner-carousel-component',
  695. * styles: [`
  696. * .banner-container {
  697. * position:relative;
  698. * height:500px;
  699. * overflow:hidden;
  700. * }
  701. * .banner-container > .banner {
  702. * position:absolute;
  703. * left:0;
  704. * top:0;
  705. * font-size:200px;
  706. * line-height:500px;
  707. * font-weight:bold;
  708. * text-align:center;
  709. * width:100%;
  710. * }
  711. * `],
  712. * template: `
  713. * <button (click)="previous()">Previous</button>
  714. * <button (click)="next()">Next</button>
  715. * <hr>
  716. * <div [\@bannerAnimation]="selectedIndex" class="banner-container">
  717. * <div class="banner" *ngFor="let banner of banners"> {{ banner }} </div>
  718. * </div>
  719. * `,
  720. * animations: [
  721. * trigger('bannerAnimation', [
  722. * transition(":increment", group([
  723. * query(':enter', [
  724. * style({ left: '100%' }),
  725. * animate('0.5s ease-out', style('*'))
  726. * ]),
  727. * query(':leave', [
  728. * animate('0.5s ease-out', style({ left: '-100%' }))
  729. * ])
  730. * ])),
  731. * transition(":decrement", group([
  732. * query(':enter', [
  733. * style({ left: '-100%' }),
  734. * animate('0.5s ease-out', style('*'))
  735. * ]),
  736. * query(':leave', [
  737. * animate('0.5s ease-out', style({ left: '100%' }))
  738. * ])
  739. * ]))
  740. * ])
  741. * ]
  742. * })
  743. * class BannerCarouselComponent {
  744. * allBanners: string[] = ['1', '2', '3', '4'];
  745. * selectedIndex: number = 0;
  746. *
  747. * get banners() {
  748. * return [this.allBanners[this.selectedIndex]];
  749. * }
  750. *
  751. * previous() {
  752. * this.selectedIndex = Math.max(this.selectedIndex - 1, 0);
  753. * }
  754. *
  755. * next() {
  756. * this.selectedIndex = Math.min(this.selectedIndex + 1, this.allBanners.length - 1);
  757. * }
  758. * }
  759. * ```
  760. *
  761. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  762. *
  763. * \@experimental Animation support is experimental.
  764. * @param {?} stateChangeExpr
  765. * @param {?} steps
  766. * @param {?=} options
  767. * @return {?}
  768. */
  769. function transition(stateChangeExpr, steps, options = null) {
  770. return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options };
  771. }
  772. /**
  773. * `animation` is an animation-specific function that is designed to be used inside of Angular's
  774. * animation DSL language.
  775. *
  776. * `var myAnimation = animation(...)` is designed to produce a reusable animation that can be later
  777. * invoked in another animation or sequence. Reusable animations are designed to make use of
  778. * animation parameters and the produced animation can be used via the `useAnimation` method.
  779. *
  780. * ```
  781. * var fadeAnimation = animation([
  782. * style({ opacity: '{{ start }}' }),
  783. * animate('{{ time }}',
  784. * style({ opacity: '{{ end }}'}))
  785. * ], { params: { time: '1000ms', start: 0, end: 1 }});
  786. * ```
  787. *
  788. * If parameters are attached to an animation then they act as **default parameter values**. When an
  789. * animation is invoked via `useAnimation` then parameter values are allowed to be passed in
  790. * directly. If any of the passed in parameter values are missing then the default values will be
  791. * used.
  792. *
  793. * ```
  794. * useAnimation(fadeAnimation, {
  795. * params: {
  796. * time: '2s',
  797. * start: 1,
  798. * end: 0
  799. * }
  800. * })
  801. * ```
  802. *
  803. * If one or more parameter values are missing before animated then an error will be thrown.
  804. *
  805. * \@experimental Animation support is experimental.
  806. * @param {?} steps
  807. * @param {?=} options
  808. * @return {?}
  809. */
  810. function animation(steps, options = null) {
  811. return { type: 8 /* Reference */, animation: steps, options };
  812. }
  813. /**
  814. * `animateChild` is an animation-specific function that is designed to be used inside of Angular's
  815. * animation DSL language. It works by allowing a queried element to execute its own
  816. * animation within the animation sequence.
  817. *
  818. * Each time an animation is triggered in angular, the parent animation
  819. * will always get priority and any child animations will be blocked. In order
  820. * for a child animation to run, the parent animation must query each of the elements
  821. * containing child animations and then allow the animations to run using `animateChild`.
  822. *
  823. * The example HTML code below shows both parent and child elements that have animation
  824. * triggers that will execute at the same time.
  825. *
  826. * ```html
  827. * <!-- parent-child.component.html -->
  828. * <button (click)="exp =! exp">Toggle</button>
  829. * <hr>
  830. *
  831. * <div [\@parentAnimation]="exp">
  832. * <header>Hello</header>
  833. * <div [\@childAnimation]="exp">
  834. * one
  835. * </div>
  836. * <div [\@childAnimation]="exp">
  837. * two
  838. * </div>
  839. * <div [\@childAnimation]="exp">
  840. * three
  841. * </div>
  842. * </div>
  843. * ```
  844. *
  845. * Now when the `exp` value changes to true, only the `parentAnimation` animation will animate
  846. * because it has priority. However, using `query` and `animateChild` each of the inner animations
  847. * can also fire:
  848. *
  849. * ```ts
  850. * // parent-child.component.ts
  851. * import {trigger, transition, animate, style, query, animateChild} from '\@angular/animations';
  852. * \@Component({
  853. * selector: 'parent-child-component',
  854. * animations: [
  855. * trigger('parentAnimation', [
  856. * transition('false => true', [
  857. * query('header', [
  858. * style({ opacity: 0 }),
  859. * animate(500, style({ opacity: 1 }))
  860. * ]),
  861. * query('\@childAnimation', [
  862. * animateChild()
  863. * ])
  864. * ])
  865. * ]),
  866. * trigger('childAnimation', [
  867. * transition('false => true', [
  868. * style({ opacity: 0 }),
  869. * animate(500, style({ opacity: 1 }))
  870. * ])
  871. * ])
  872. * ]
  873. * })
  874. * class ParentChildCmp {
  875. * exp: boolean = false;
  876. * }
  877. * ```
  878. *
  879. * In the animation code above, when the `parentAnimation` transition kicks off it first queries to
  880. * find the header element and fades it in. It then finds each of the sub elements that contain the
  881. * `\@childAnimation` trigger and then allows for their animations to fire.
  882. *
  883. * This example can be further extended by using stagger:
  884. *
  885. * ```ts
  886. * query('\@childAnimation', stagger(100, [
  887. * animateChild()
  888. * ]))
  889. * ```
  890. *
  891. * Now each of the sub animations start off with respect to the `100ms` staggering step.
  892. *
  893. * ## The first frame of child animations
  894. * When sub animations are executed using `animateChild` the animation engine will always apply the
  895. * first frame of every sub animation immediately at the start of the animation sequence. This way
  896. * the parent animation does not need to set any initial styling data on the sub elements before the
  897. * sub animations kick off.
  898. *
  899. * In the example above the first frame of the `childAnimation`'s `false => true` transition
  900. * consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation`
  901. * animation transition sequence starts. Only then when the `\@childAnimation` is queried and called
  902. * with `animateChild` will it then animate to its destination of `opacity: 1`.
  903. *
  904. * Note that this feature designed to be used alongside {\@link query query()} and it will only work
  905. * with animations that are assigned using the Angular animation DSL (this means that CSS keyframes
  906. * and transitions are not handled by this API).
  907. *
  908. * \@experimental Animation support is experimental.
  909. * @param {?=} options
  910. * @return {?}
  911. */
  912. function animateChild(options = null) {
  913. return { type: 9 /* AnimateChild */, options };
  914. }
  915. /**
  916. * `useAnimation` is an animation-specific function that is designed to be used inside of Angular's
  917. * animation DSL language. It is used to kick off a reusable animation that is created using {\@link
  918. * animation animation()}.
  919. *
  920. * \@experimental Animation support is experimental.
  921. * @param {?} animation
  922. * @param {?=} options
  923. * @return {?}
  924. */
  925. function useAnimation(animation, options = null) {
  926. return { type: 10 /* AnimateRef */, animation, options };
  927. }
  928. /**
  929. * `query` is an animation-specific function that is designed to be used inside of Angular's
  930. * animation DSL language.
  931. *
  932. * query() is used to find one or more inner elements within the current element that is
  933. * being animated within the sequence. The provided animation steps are applied
  934. * to the queried element (by default, an array is provided, then this will be
  935. * treated as an animation sequence).
  936. *
  937. * ### Usage
  938. *
  939. * query() is designed to collect mutiple elements and works internally by using
  940. * `element.querySelectorAll`. An additional options object can be provided which
  941. * can be used to limit the total amount of items to be collected.
  942. *
  943. * ```js
  944. * query('div', [
  945. * animate(...),
  946. * animate(...)
  947. * ], { limit: 1 })
  948. * ```
  949. *
  950. * query(), by default, will throw an error when zero items are found. If a query
  951. * has the `optional` flag set to true then this error will be ignored.
  952. *
  953. * ```js
  954. * query('.some-element-that-may-not-be-there', [
  955. * animate(...),
  956. * animate(...)
  957. * ], { optional: true })
  958. * ```
  959. *
  960. * ### Special Selector Values
  961. *
  962. * The selector value within a query can collect elements that contain angular-specific
  963. * characteristics
  964. * using special pseudo-selectors tokens.
  965. *
  966. * These include:
  967. *
  968. * - Querying for newly inserted/removed elements using `query(":enter")`/`query(":leave")`
  969. * - Querying all currently animating elements using `query(":animating")`
  970. * - Querying elements that contain an animation trigger using `query("\@triggerName")`
  971. * - Querying all elements that contain an animation triggers using `query("\@*")`
  972. * - Including the current element into the animation sequence using `query(":self")`
  973. *
  974. *
  975. * Each of these pseudo-selector tokens can be merged together into a combined query selector
  976. * string:
  977. *
  978. * ```
  979. * query(':self, .record:enter, .record:leave, \@subTrigger', [...])
  980. * ```
  981. *
  982. * ### Demo
  983. *
  984. * ```
  985. * \@Component({
  986. * selector: 'inner',
  987. * template: `
  988. * <div [\@queryAnimation]="exp">
  989. * <h1>Title</h1>
  990. * <div class="content">
  991. * Blah blah blah
  992. * </div>
  993. * </div>
  994. * `,
  995. * animations: [
  996. * trigger('queryAnimation', [
  997. * transition('* => goAnimate', [
  998. * // hide the inner elements
  999. * query('h1', style({ opacity: 0 })),
  1000. * query('.content', style({ opacity: 0 })),
  1001. *
  1002. * // animate the inner elements in, one by one
  1003. * query('h1', animate(1000, style({ opacity: 1 })),
  1004. * query('.content', animate(1000, style({ opacity: 1 })),
  1005. * ])
  1006. * ])
  1007. * ]
  1008. * })
  1009. * class Cmp {
  1010. * exp = '';
  1011. *
  1012. * goAnimate() {
  1013. * this.exp = 'goAnimate';
  1014. * }
  1015. * }
  1016. * ```
  1017. *
  1018. * \@experimental Animation support is experimental.
  1019. * @param {?} selector
  1020. * @param {?} animation
  1021. * @param {?=} options
  1022. * @return {?}
  1023. */
  1024. function query(selector, animation, options = null) {
  1025. return { type: 11 /* Query */, selector, animation, options };
  1026. }
  1027. /**
  1028. * `stagger` is an animation-specific function that is designed to be used inside of Angular's
  1029. * animation DSL language. It is designed to be used inside of an animation {\@link query query()}
  1030. * and works by issuing a timing gap between after each queried item is animated.
  1031. *
  1032. * ### Usage
  1033. *
  1034. * In the example below there is a container element that wraps a list of items stamped out
  1035. * by an ngFor. The container element contains an animation trigger that will later be set
  1036. * to query for each of the inner items.
  1037. *
  1038. * ```html
  1039. * <!-- list.component.html -->
  1040. * <button (click)="toggle()">Show / Hide Items</button>
  1041. * <hr />
  1042. * <div [\@listAnimation]="items.length">
  1043. * <div *ngFor="let item of items">
  1044. * {{ item }}
  1045. * </div>
  1046. * </div>
  1047. * ```
  1048. *
  1049. * The component code for this looks as such:
  1050. *
  1051. * ```ts
  1052. * import {trigger, transition, style, animate, query, stagger} from '\@angular/animations';
  1053. * \@Component({
  1054. * templateUrl: 'list.component.html',
  1055. * animations: [
  1056. * trigger('listAnimation', [
  1057. * //...
  1058. * ])
  1059. * ]
  1060. * })
  1061. * class ListComponent {
  1062. * items = [];
  1063. *
  1064. * showItems() {
  1065. * this.items = [0,1,2,3,4];
  1066. * }
  1067. *
  1068. * hideItems() {
  1069. * this.items = [];
  1070. * }
  1071. *
  1072. * toggle() {
  1073. * this.items.length ? this.hideItems() : this.showItems();
  1074. * }
  1075. * }
  1076. * ```
  1077. *
  1078. * And now for the animation trigger code:
  1079. *
  1080. * ```ts
  1081. * trigger('listAnimation', [
  1082. * transition('* => *', [ // each time the binding value changes
  1083. * query(':leave', [
  1084. * stagger(100, [
  1085. * animate('0.5s', style({ opacity: 0 }))
  1086. * ])
  1087. * ]),
  1088. * query(':enter', [
  1089. * style({ opacity: 0 }),
  1090. * stagger(100, [
  1091. * animate('0.5s', style({ opacity: 1 }))
  1092. * ])
  1093. * ])
  1094. * ])
  1095. * ])
  1096. * ```
  1097. *
  1098. * Now each time the items are added/removed then either the opacity
  1099. * fade-in animation will run or each removed item will be faded out.
  1100. * When either of these animations occur then a stagger effect will be
  1101. * applied after each item's animation is started.
  1102. *
  1103. * \@experimental Animation support is experimental.
  1104. * @param {?} timings
  1105. * @param {?} animation
  1106. * @return {?}
  1107. */
  1108. function stagger(timings, animation) {
  1109. return { type: 12 /* Stagger */, timings, animation };
  1110. }
  1111. /**
  1112. * @fileoverview added by tsickle
  1113. * @suppress {checkTypes} checked by tsc
  1114. */
  1115. /**
  1116. * @license
  1117. * Copyright Google Inc. All Rights Reserved.
  1118. *
  1119. * Use of this source code is governed by an MIT-style license that can be
  1120. * found in the LICENSE file at https://angular.io/license
  1121. * @param {?} cb
  1122. * @return {?}
  1123. */
  1124. function scheduleMicroTask(cb) {
  1125. Promise.resolve(null).then(cb);
  1126. }
  1127. /**
  1128. * @fileoverview added by tsickle
  1129. * @suppress {checkTypes} checked by tsc
  1130. */
  1131. /**
  1132. * AnimationPlayer controls an animation sequence that was produced from a programmatic animation.
  1133. * (see {\@link AnimationBuilder AnimationBuilder} for more information on how to create programmatic
  1134. * animations.)
  1135. *
  1136. * \@experimental Animation support is experimental.
  1137. * @record
  1138. */
  1139. /**
  1140. * \@experimental Animation support is experimental.
  1141. */
  1142. class NoopAnimationPlayer {
  1143. constructor() {
  1144. this._onDoneFns = [];
  1145. this._onStartFns = [];
  1146. this._onDestroyFns = [];
  1147. this._started = false;
  1148. this._destroyed = false;
  1149. this._finished = false;
  1150. this.parentPlayer = null;
  1151. this.totalTime = 0;
  1152. }
  1153. /**
  1154. * @return {?}
  1155. */
  1156. _onFinish() {
  1157. if (!this._finished) {
  1158. this._finished = true;
  1159. this._onDoneFns.forEach(fn => fn());
  1160. this._onDoneFns = [];
  1161. }
  1162. }
  1163. /**
  1164. * @param {?} fn
  1165. * @return {?}
  1166. */
  1167. onStart(fn) { this._onStartFns.push(fn); }
  1168. /**
  1169. * @param {?} fn
  1170. * @return {?}
  1171. */
  1172. onDone(fn) { this._onDoneFns.push(fn); }
  1173. /**
  1174. * @param {?} fn
  1175. * @return {?}
  1176. */
  1177. onDestroy(fn) { this._onDestroyFns.push(fn); }
  1178. /**
  1179. * @return {?}
  1180. */
  1181. hasStarted() { return this._started; }
  1182. /**
  1183. * @return {?}
  1184. */
  1185. init() { }
  1186. /**
  1187. * @return {?}
  1188. */
  1189. play() {
  1190. if (!this.hasStarted()) {
  1191. this._onStart();
  1192. this.triggerMicrotask();
  1193. }
  1194. this._started = true;
  1195. }
  1196. /**
  1197. * @return {?}
  1198. */
  1199. triggerMicrotask() { scheduleMicroTask(() => this._onFinish()); }
  1200. /**
  1201. * @return {?}
  1202. */
  1203. _onStart() {
  1204. this._onStartFns.forEach(fn => fn());
  1205. this._onStartFns = [];
  1206. }
  1207. /**
  1208. * @return {?}
  1209. */
  1210. pause() { }
  1211. /**
  1212. * @return {?}
  1213. */
  1214. restart() { }
  1215. /**
  1216. * @return {?}
  1217. */
  1218. finish() { this._onFinish(); }
  1219. /**
  1220. * @return {?}
  1221. */
  1222. destroy() {
  1223. if (!this._destroyed) {
  1224. this._destroyed = true;
  1225. if (!this.hasStarted()) {
  1226. this._onStart();
  1227. }
  1228. this.finish();
  1229. this._onDestroyFns.forEach(fn => fn());
  1230. this._onDestroyFns = [];
  1231. }
  1232. }
  1233. /**
  1234. * @return {?}
  1235. */
  1236. reset() { }
  1237. /**
  1238. * @param {?} p
  1239. * @return {?}
  1240. */
  1241. setPosition(p) { }
  1242. /**
  1243. * @return {?}
  1244. */
  1245. getPosition() { return 0; }
  1246. /**
  1247. * @param {?} phaseName
  1248. * @return {?}
  1249. */
  1250. triggerCallback(phaseName) {
  1251. const /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
  1252. methods.forEach(fn => fn());
  1253. methods.length = 0;
  1254. }
  1255. }
  1256. /**
  1257. * @fileoverview added by tsickle
  1258. * @suppress {checkTypes} checked by tsc
  1259. */
  1260. /**
  1261. * @license
  1262. * Copyright Google Inc. All Rights Reserved.
  1263. *
  1264. * Use of this source code is governed by an MIT-style license that can be
  1265. * found in the LICENSE file at https://angular.io/license
  1266. */
  1267. class AnimationGroupPlayer {
  1268. /**
  1269. * @param {?} _players
  1270. */
  1271. constructor(_players) {
  1272. this._onDoneFns = [];
  1273. this._onStartFns = [];
  1274. this._finished = false;
  1275. this._started = false;
  1276. this._destroyed = false;
  1277. this._onDestroyFns = [];
  1278. this.parentPlayer = null;
  1279. this.totalTime = 0;
  1280. this.players = _players;
  1281. let /** @type {?} */ doneCount = 0;
  1282. let /** @type {?} */ destroyCount = 0;
  1283. let /** @type {?} */ startCount = 0;
  1284. const /** @type {?} */ total = this.players.length;
  1285. if (total == 0) {
  1286. scheduleMicroTask(() => this._onFinish());
  1287. }
  1288. else {
  1289. this.players.forEach(player => {
  1290. player.onDone(() => {
  1291. if (++doneCount == total) {
  1292. this._onFinish();
  1293. }
  1294. });
  1295. player.onDestroy(() => {
  1296. if (++destroyCount == total) {
  1297. this._onDestroy();
  1298. }
  1299. });
  1300. player.onStart(() => {
  1301. if (++startCount == total) {
  1302. this._onStart();
  1303. }
  1304. });
  1305. });
  1306. }
  1307. this.totalTime = this.players.reduce((time, player) => Math.max(time, player.totalTime), 0);
  1308. }
  1309. /**
  1310. * @return {?}
  1311. */
  1312. _onFinish() {
  1313. if (!this._finished) {
  1314. this._finished = true;
  1315. this._onDoneFns.forEach(fn => fn());
  1316. this._onDoneFns = [];
  1317. }
  1318. }
  1319. /**
  1320. * @return {?}
  1321. */
  1322. init() { this.players.forEach(player => player.init()); }
  1323. /**
  1324. * @param {?} fn
  1325. * @return {?}
  1326. */
  1327. onStart(fn) { this._onStartFns.push(fn); }
  1328. /**
  1329. * @return {?}
  1330. */
  1331. _onStart() {
  1332. if (!this.hasStarted()) {
  1333. this._started = true;
  1334. this._onStartFns.forEach(fn => fn());
  1335. this._onStartFns = [];
  1336. }
  1337. }
  1338. /**
  1339. * @param {?} fn
  1340. * @return {?}
  1341. */
  1342. onDone(fn) { this._onDoneFns.push(fn); }
  1343. /**
  1344. * @param {?} fn
  1345. * @return {?}
  1346. */
  1347. onDestroy(fn) { this._onDestroyFns.push(fn); }
  1348. /**
  1349. * @return {?}
  1350. */
  1351. hasStarted() { return this._started; }
  1352. /**
  1353. * @return {?}
  1354. */
  1355. play() {
  1356. if (!this.parentPlayer) {
  1357. this.init();
  1358. }
  1359. this._onStart();
  1360. this.players.forEach(player => player.play());
  1361. }
  1362. /**
  1363. * @return {?}
  1364. */
  1365. pause() { this.players.forEach(player => player.pause()); }
  1366. /**
  1367. * @return {?}
  1368. */
  1369. restart() { this.players.forEach(player => player.restart()); }
  1370. /**
  1371. * @return {?}
  1372. */
  1373. finish() {
  1374. this._onFinish();
  1375. this.players.forEach(player => player.finish());
  1376. }
  1377. /**
  1378. * @return {?}
  1379. */
  1380. destroy() { this._onDestroy(); }
  1381. /**
  1382. * @return {?}
  1383. */
  1384. _onDestroy() {
  1385. if (!this._destroyed) {
  1386. this._destroyed = true;
  1387. this._onFinish();
  1388. this.players.forEach(player => player.destroy());
  1389. this._onDestroyFns.forEach(fn => fn());
  1390. this._onDestroyFns = [];
  1391. }
  1392. }
  1393. /**
  1394. * @return {?}
  1395. */
  1396. reset() {
  1397. this.players.forEach(player => player.reset());
  1398. this._destroyed = false;
  1399. this._finished = false;
  1400. this._started = false;
  1401. }
  1402. /**
  1403. * @param {?} p
  1404. * @return {?}
  1405. */
  1406. setPosition(p) {
  1407. const /** @type {?} */ timeAtPosition = p * this.totalTime;
  1408. this.players.forEach(player => {
  1409. const /** @type {?} */ position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1;
  1410. player.setPosition(position);
  1411. });
  1412. }
  1413. /**
  1414. * @return {?}
  1415. */
  1416. getPosition() {
  1417. let /** @type {?} */ min = 0;
  1418. this.players.forEach(player => {
  1419. const /** @type {?} */ p = player.getPosition();
  1420. min = Math.min(p, min);
  1421. });
  1422. return min;
  1423. }
  1424. /**
  1425. * @return {?}
  1426. */
  1427. beforeDestroy() {
  1428. this.players.forEach(player => {
  1429. if (player.beforeDestroy) {
  1430. player.beforeDestroy();
  1431. }
  1432. });
  1433. }
  1434. /**
  1435. * @param {?} phaseName
  1436. * @return {?}
  1437. */
  1438. triggerCallback(phaseName) {
  1439. const /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
  1440. methods.forEach(fn => fn());
  1441. methods.length = 0;
  1442. }
  1443. }
  1444. /**
  1445. * @fileoverview added by tsickle
  1446. * @suppress {checkTypes} checked by tsc
  1447. */
  1448. const ɵPRE_STYLE = '!';
  1449. /**
  1450. * @fileoverview added by tsickle
  1451. * @suppress {checkTypes} checked by tsc
  1452. */
  1453. /**
  1454. * @license
  1455. * Copyright Google Inc. All Rights Reserved.
  1456. *
  1457. * Use of this source code is governed by an MIT-style license that can be
  1458. * found in the LICENSE file at https://angular.io/license
  1459. */
  1460. /**
  1461. * @fileoverview added by tsickle
  1462. * @suppress {checkTypes} checked by tsc
  1463. */
  1464. /**
  1465. * @license
  1466. * Copyright Google Inc. All Rights Reserved.
  1467. *
  1468. * Use of this source code is governed by an MIT-style license that can be
  1469. * found in the LICENSE file at https://angular.io/license
  1470. */
  1471. /**
  1472. * @module
  1473. * @description
  1474. * Entry point for all public APIs of this package.
  1475. */
  1476. /**
  1477. * @fileoverview added by tsickle
  1478. * @suppress {checkTypes} checked by tsc
  1479. */
  1480. /**
  1481. * Generated bundle index. Do not edit.
  1482. */
  1483. export { AnimationBuilder, AnimationFactory, AUTO_STYLE, animate, animateChild, animation, group, keyframes, query, sequence, stagger, state, style, transition, trigger, useAnimation, NoopAnimationPlayer, AnimationGroupPlayer as ɵAnimationGroupPlayer, ɵPRE_STYLE };
  1484. //# sourceMappingURL=animations.js.map