5 lines
27 KiB
JSON

{
"id": "api/animations/animation",
"title": "animation",
"contents": "\n\n<article>\n <div class=\"breadcrumb-container\">\n <div class=\"breadcrumb\">\n <script type=\"application/ld+json\">\n {\n \"@context\": \"http://schema.org\",\n \"@type\": \"BreadcrumbList\",\n \"itemListElement\": [\n { \"@type\": \"ListItem\", \"position\": 1, \"item\": { \"@id\": \"https://angular.io//api\", \"name\": \"API\" } },\n { \"@type\": \"ListItem\", \"position\": 2, \"item\": { \"@id\": \"https://angular.io/api/animations\", \"name\": \"@angular/animations\" } },\n { \"@type\": \"ListItem\", \"position\": 3, \"item\": { \"@id\": \"https://angular.io/api/animations/animation\", \"name\": \"animation\" } }\n ]\n }\n </script>\n <a href=\"/api\">API</a> > <a href=\"api/animations\">@angular/animations</a>\n </div>\n <div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/packages/animations/src/animation_metadata.ts?message=docs(animations)%3A%20describe%20your%20change...#L1048-L1098\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n <a href=\"https://github.com/angular/angular/tree/12.0.0-next.7/packages/animations/src/animation_metadata.ts#L1048-L1098\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n </div>\n \n <header class=\"api-header\">\n <h1 id=\"animation\">animation<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/animations/animation#animation\"><i class=\"material-icons\">link</i></a></h1>\n \n <label class=\"api-type-label function\">function</label>\n \n \n \n </header>\n \n <aio-toc class=\"embedded\"></aio-toc>\n\n <div class=\"api-body\">\n \n <section class=\"short-description\">\n <p>Produces a reusable animation that can be invoked in another animation or sequence,\nby calling the <code><a href=\"api/animations/useAnimation\" class=\"code-anchor\">useAnimation</a>()</code> function.</p>\n\n \n </section>\n \n \n \n\n <div class=\"overload-info\">\n \n\n <code-example language=\"ts\" hidecopy=\"true\" class=\"no-box api-heading\"> <span class=\"member-name\"><a href=\"api/animations/animation\" class=\"code-anchor\">animation</a></span>(steps: <a href=\"api/animations/AnimationMetadata\" class=\"code-anchor\">AnimationMetadata</a> | <a href=\"api/animations/AnimationMetadata\" class=\"code-anchor\">AnimationMetadata</a>[], options: <a href=\"api/animations/AnimationOptions\" class=\"code-anchor\">AnimationOptions</a> = null): <a href=\"api/animations/AnimationReferenceMetadata\" class=\"code-anchor\">AnimationReferenceMetadata</a></code-example>\n\n \n\n <h6 class=\"no-anchor\" id=\"parameters\">Parameters</h6>\n <table class=\"is-full-width list-table parameters-table function-overload-parameters\">\n <tbody>\n \n <tr class=\"function-overload-parameter\">\n <td class=\"param-name\">\n <a id=\"\"></a>\n <code>steps</code>\n </td>\n <td class=\"param-type\"><code><a href=\"api/animations/AnimationMetadata\" class=\"code-anchor\">AnimationMetadata</a> | <a href=\"api/animations/AnimationMetadata\" class=\"code-anchor\">AnimationMetadata</a>[]</code></td>\n <td class=\"param-description\">\n <p>One or more animation objects, as returned by the <code><a href=\"api/animations/animate\" class=\"code-anchor\">animate</a>()</code>\nor <code><a href=\"api/animations/sequence\" class=\"code-anchor\">sequence</a>()</code> function, that form a transformation from one state to another.\nA sequence is used by default when you pass an array.</p>\n\n </td>\n </tr>\n <tr class=\"function-overload-parameter\">\n <td class=\"param-name\">\n <a id=\"\"></a>\n <code>options</code>\n </td>\n <td class=\"param-type\"><code><a href=\"api/animations/AnimationOptions\" class=\"code-anchor\">AnimationOptions</a></code></td>\n <td class=\"param-description\">\n <p>An options object that can contain a delay value for the start of the\nanimation, and additional developer-defined parameters.\nProvided values for additional parameters are used as defaults,\nand override values can be passed to the caller on invocation.</p>\n<p> Optional. Default is <code>null</code>.</p>\n\n </td>\n </tr>\n </tbody>\n</table>\n\n \n <h6 class=\"no-anchor\" id=\"returns\">Returns</h6>\n <p><code><a href=\"api/animations/AnimationReferenceMetadata\" class=\"code-anchor\">AnimationReferenceMetadata</a></code>: An object that encapsulates the animation data.</p>\n \n \n\n\n \n\n \n</div>\n\n\n \n\n \n\n\n\n \n<section class=\"usage-notes\">\n <h2 id=\"usage-notes\">Usage notes<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/animations/animation#usage-notes\"><i class=\"material-icons\">link</i></a></h2>\n <p>The following example defines a reusable animation, providing some default parameter\nvalues.</p>\n<code-example language=\"typescript\">\nvar fadeAnimation = <a href=\"api/animations/animation\" class=\"code-anchor\">animation</a>([\n <a href=\"api/animations/style\" class=\"code-anchor\">style</a>({ opacity: '{{ start }}' }),\n <a href=\"api/animations/animate\" class=\"code-anchor\">animate</a>('{{ time }}',\n <a href=\"api/animations/style\" class=\"code-anchor\">style</a>({ opacity: '{{ end }}'}))\n ],\n { params: { time: '1000ms', start: 0, end: 1 }});\n</code-example>\n<p>The following invokes the defined animation with a call to <code><a href=\"api/animations/useAnimation\" class=\"code-anchor\">useAnimation</a>()</code>,\npassing in override parameter values.</p>\n<code-example language=\"js\">\n<a href=\"api/animations/useAnimation\" class=\"code-anchor\">useAnimation</a>(fadeAnimation, {\n params: {\n time: '2s',\n start: 1,\n end: 0\n }\n})\n</code-example>\n<p>If any of the passed-in parameter values are missing from this call,\nthe default values are used. If one or more parameter values are missing before a step is\nanimated, <code><a href=\"api/animations/useAnimation\" class=\"code-anchor\">useAnimation</a>()</code> throws an error.</p>\n\n</section>\n\n\n\n </div>\n</article>\n\n<!-- links to this doc:\n - api/animations\n - api/animations/AnimationAnimateRefMetadata\n - api/animations/AnimationBuilder\n - api/animations/AnimationMetadataType\n - api/animations/AnimationOptions\n - api/animations/AnimationQueryMetadata\n - api/animations/AnimationReferenceMetadata\n - api/animations/AnimationStaggerMetadata\n - api/animations/AnimationTransitionMetadata\n - api/animations/query\n - api/animations/stagger\n - api/animations/transition\n - api/animations/trigger\n - api/animations/useAnimation\n - guide/animations\n - guide/reusable-animations\n - guide/route-animations\n - guide/router-tutorial-toh\n - guide/transition-and-triggers\n-->\n<!-- links from this doc:\n - /api\n - api/animations\n - api/animations/AnimationMetadata\n - api/animations/AnimationOptions\n - api/animations/AnimationReferenceMetadata\n - api/animations/animate\n - api/animations/animation#animation\n - api/animations/animation#usage-notes\n - api/animations/sequence\n - api/animations/style\n - api/animations/useAnimation\n - https://github.com/angular/angular/edit/master/packages/animations/src/animation_metadata.ts?message=docs(animations)%3A%20describe%20your%20change...#L1048-L1098\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/animations/src/animation_metadata.ts#L1048-L1098\n-->"
}