Angular10 Animation animate() Function Last Updated : 06 Jan, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we are going to see what is animate in Angular 10 and how to use it. The animate in Angular10 is used to define an animation step that combines styling information with timing information Syntax: animate(timings | styles) NgModule: Module used by animate is: animations Approach: Create the angular app to be usedIn app.module.ts import BrowserAnimationsModuleIn app.component.html make a div which will contain the animation element.In app.component.ts import the trigger, state, style, transition, animate to be used.Make the animation using animation() containing timing and styles.Serve the angular app using ng serve to see the output Parameters: timing: Sets AnimateTimings for the parent animationstyles: Sets AnimationStyles for the parent animation Return Value: AnimationAnimateMetadata: An object that encapsulates the animation step Example 1: app.module.ts import { LOCALE_ID, NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, AppRoutingModule, BrowserAnimationsModule ], providers: [ { provide: LOCALE_ID, useValue: 'en-GB' }, ], bootstrap: [AppComponent] }) export class AppModule { } app.component.ts import { trigger, state, style, transition, animate } from '@angular/animations'; import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: [ './app.component.css' ], animations: [ trigger('gfg',[ state('normal', style({ 'background-color': 'red', transform: 'translateX(0)' })), state('highlighted', style({ 'background-color': 'blue', transform: 'translateX(0)' })), transition('normal => highlighted',animate(1200)), transition('highlighted => normal',animate(1000)) ]) ] }) export class AppComponent { state = 'normal'; anim(){ this.state == 'normal' ? this.state = 'highlighted' : this.state = 'normal'; } } app.component.html <h1>GeeksforGeeks</h1> <button (click)='anim()'>Animate</button> <div style="width: 100px; height: 100px" [@gfg]='state'> </div> Output: Reference: https://angular.io/api/animations/animate Comment More infoAdvertise with us Next Article Angular10 Animation animate() Function T taran910 Follow Improve Article Tags : Web Technologies AngularJS Angular10 Similar Reads Angular10 animation transition API In this article, we are going to see what is transition in Angular 10 and how to use it. The transition in Angular10 is used to create a transition for the animation in which an element will go from one state to another. Syntax: transition (stateChangeExpr, steps, options) NgModule: Module used by t 2 min read Angular10 Trigger Animation In this article, we are going to see what is trigger in Angular 10 and how to use it. The trigger in Angular10 is used to create an animation trigger containing state and transition of the animation. Syntax: animate(name | definitions) NgModule: Module used by trigger is: animations  Approach: Cre 2 min read Animations in AngularJS Applications AngularJS is the initial version of Angular Framework. As in the latest Angular2+ versions, there are different libraries that can be used to provide advanced animations to the application. Animations are the existing features given to the application that improve the user experiences and also add i 5 min read Angular10 State Animation In this article, we are going to see what is State in Angular 10 and how to use it. The State in Angular10 is used to create an animation trigger containing state and transition of the animation. Syntax: State(name, style, options) NgModule: Module used by State is: animations  Approach: Create an 2 min read Angular10 animation Style API In this article, we are going to see what is Style in Angular 10 and how to use it. The Style in Angular10 is used to create a key/value object containing CSS properties/styles that can be used for an animation state. Syntax: Style(tokens) NgModule: Module used by Style is: animations Approach: Crea 1 min read Like