5 lines
9.3 KiB
JSON

{
"id": "api/animations/AnimationBuilder",
"title": "AnimationBuilder",
"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/AnimationBuilder\", \"name\": \"AnimationBuilder\" } }\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_builder.ts?message=docs(animations)%3A%20describe%20your%20change...#L10-L65\" 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_builder.ts#L10-L65\" 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=\"animationbuilder\">AnimationBuilder<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/animations/AnimationBuilder#animationbuilder\"><i class=\"material-icons\">link</i></a></h1>\n \n <label class=\"api-type-label class\">class</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>An injectable service that produces an animation sequence programmatically within an\nAngular component or directive.\nProvided by the <code><a href=\"api/platform-browser/animations/BrowserAnimationsModule\" class=\"code-anchor\">BrowserAnimationsModule</a></code> or <code><a href=\"api/platform-browser/animations/NoopAnimationsModule\" class=\"code-anchor\">NoopAnimationsModule</a></code>.</p>\n\n \n </section>\n \n \n \n <section class=\"class-overview\">\n<code-example language=\"ts\" hidecopy=\"true\">\nabstract class <a href=\"api/animations/AnimationBuilder\" class=\"code-anchor\">AnimationBuilder</a> {\n <a class=\"code-anchor\" href=\"api/animations/AnimationBuilder#build\">abstract <span class=\"member-name\">build</span>(animation: AnimationMetadata | AnimationMetadata[]): AnimationFactory</a>\n}\n</code-example>\n\n \n \n\n</section>\n\n\n \n\n \n \n \n\n\n\n\n\n\n\n\n\n\n\n\n<section class=\"instance-methods\">\n <h2 id=\"methods\">Methods<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/animations/AnimationBuilder#methods\"><i class=\"material-icons\">link</i></a></h2>\n \n <a id=\"build\"></a>\n<table class=\"is-full-width method-table instance-method\">\n <thead><tr><th>\n <div class=\"with-github-links\">\n <h3 id=\"build\">\n build()\n \n <a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/animations/AnimationBuilder#build\"><i class=\"material-icons\">link</i></a></h3>\n <div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/packages/animations/src/animation_builder.ts?message=docs(animations)%3A%20describe%20your%20change...#L58-L64\" 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_builder.ts#L58-L64\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n </div>\n </th></tr></thead>\n <tbody>\n <tr>\n <td class=\"short-description\">\n <p>Builds a factory for producing a defined animation.</p>\n\n <p>See also:</p>\n <ul>\n \n <li><p><code><a href=\"api/animations/animate\" class=\"code-anchor\">animate</a>()</code></p>\n</li>\n </ul>\n \n </td>\n </tr>\n \n <tr>\n <td>\n <div class=\"overload-info\">\n \n\n <code-example language=\"ts\" hidecopy=\"true\" class=\"no-box api-heading\">abstract <span class=\"member-name\">build</span>(animation: AnimationMetadata | AnimationMetadata[]): AnimationFactory</code-example>\n\n \n\n <h6 class=\"no-anchor\" id=\"parameters\">Parameters</h6>\n <table class=\"is-full-width list-table parameters-table instance-method-overload-parameters\">\n <tbody>\n \n <tr class=\"instance-method-overload-parameter\">\n <td class=\"param-name\">\n <a id=\"\"></a>\n <code><a href=\"api/animations/animation\" class=\"code-anchor\">animation</a></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>A reusable animation definition.</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/AnimationFactory\" class=\"code-anchor\">AnimationFactory</a></code>: A factory object that can create a player for the defined animation.</p>\n\n \n\n\n \n\n \n</div>\n </td>\n </tr>\n \n\n \n\n \n </tbody>\n</table>\n\n \n</section>\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/AnimationBuilder#usage-notes\"><i class=\"material-icons\">link</i></a></h2>\n <p>To use this service, add it to your component or directive as a dependency.\nThe service is instantiated along with your component.</p>\n<p>Apps do not typically need to create their own animation players, but if you\ndo need to, follow these steps:</p>\n<ol>\n<li>\n<p>Use the <code>build()</code> method to create a programmatic animation using the\n<code><a href=\"api/animations/animate\" class=\"code-anchor\">animate</a>()</code> function. The method returns an <code><a href=\"api/animations/AnimationFactory\" class=\"code-anchor\">AnimationFactory</a></code> instance.</p>\n</li>\n<li>\n<p>Use the factory object to create an <code><a href=\"api/animations/AnimationPlayer\" class=\"code-anchor\">AnimationPlayer</a></code> and attach it to a DOM element.</p>\n</li>\n<li>\n<p>Use the player object to control the animation programmatically.</p>\n</li>\n</ol>\n<p>For example:</p>\n<code-example language=\"ts\">\n// import the service from <a href=\"api/platform-browser/animations/BrowserAnimationsModule\" class=\"code-anchor\">BrowserAnimationsModule</a>\nimport {<a href=\"api/animations/AnimationBuilder\" class=\"code-anchor\">AnimationBuilder</a>} from '@angular/animations';\n// require the service as a dependency\nclass MyCmp {\n constructor(private _builder: <a href=\"api/animations/AnimationBuilder\" class=\"code-anchor\">AnimationBuilder</a>) {}\n\n makeAnimation(element: any) {\n // first define a reusable <a href=\"api/animations/animation\" class=\"code-anchor\">animation</a>\n const myAnimation = this._builder.build([\n <a href=\"api/animations/style\" class=\"code-anchor\">style</a>({ width: 0 }),\n <a href=\"api/animations/animate\" class=\"code-anchor\">animate</a>(1000, <a href=\"api/animations/style\" class=\"code-anchor\">style</a>({ width: '100px' }))\n ]);\n\n // use the returned factory object to create a player\n const player = myAnimation.create(element);\n\n player.play();\n }\n}\n</code-example>\n\n</section>\n\n\n\n </div>\n</article>\n\n<!-- links to this doc:\n - api/animations\n - api/animations/AnimationFactory\n - api/animations/AnimationOptions\n - api/animations/AnimationPlayer\n - guide/browser-support\n-->\n<!-- links from this doc:\n - /api\n - api/animations\n - api/animations/AnimationBuilder#animationbuilder\n - api/animations/AnimationBuilder#build\n - api/animations/AnimationBuilder#methods\n - api/animations/AnimationBuilder#usage-notes\n - api/animations/AnimationFactory\n - api/animations/AnimationMetadata\n - api/animations/AnimationPlayer\n - api/animations/animate\n - api/animations/animation\n - api/animations/style\n - api/platform-browser/animations/BrowserAnimationsModule\n - api/platform-browser/animations/NoopAnimationsModule\n - https://github.com/angular/angular/edit/master/packages/animations/src/animation_builder.ts?message=docs(animations)%3A%20describe%20your%20change...#L10-L65\n - https://github.com/angular/angular/edit/master/packages/animations/src/animation_builder.ts?message=docs(animations)%3A%20describe%20your%20change...#L58-L64\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/animations/src/animation_builder.ts#L10-L65\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/animations/src/animation_builder.ts#L58-L64\n-->"
}