Import it from @grafloria/angular.
Angular-injectable Animation Service
This service wraps the framework-agnostic AnimationService and provides:
- Angular dependency injection
- Automatic cleanup on destroy
- Convenient preset application methods
- Reactive configuration updates
ts@Injectable({
providedIn: 'root'
})
export class AngularAnimationService implements OnDestroy
Properties
| Name | Type | Default | Description |
|---|---|---|---|
presets | Export presets for easy access |
Methods
constructor()setEnabled(enabled: boolean): void— Enable or disable all animations globallygetConfig(): Readonly<AnimationConfig>— Get current configurationupdateConfig(config: Partial<AnimationConfig>): void— Update configuration (partial update)getEdgeAnimationClass(link: LinkModel): string— Get animation CSS classes for an edge (link)getNodeAnimationClass(node: NodeModel, useSVGVariant: boolean = false): string— Get animation CSS classes for a nodegetAnimationDuration(baseDuration: number): number— Calculate animation duration with speed multiplier appliedpauseAllAnimations(): void— Pause all animations (for debugging or screenshots)resumeAllAnimations(): void— Resume all animationsonConfigChange(listener: (config: AnimationConfig) => void): () => void— Add listener for configuration changesresetConfig(): void— Reset configuration to defaultsinjectCSS(): void— Inject animation CSS into the documentremoveCSS(): void— Remove injected animation CSS from the documentisCSSInjected(): boolean— Check if CSS has been injectedapplyNodePreset( node: NodeModel, preset: typeof AnimationPresets.NODE[keyof typeof AnimationPresets.NODE] ): NodeModel— Apply a node preset to a node Convenient wrapper that modifies the node in placeapplyWorkflowPreset( node: NodeModel, preset: typeof AnimationPresets.WORKFLOW[keyof typeof AnimationPresets.WORKFLOW] | typeof AnimationPresets.ETL[keyof typeof AnimationPresets.ETL] | typeof AnimationPresets.MONITORING[keyof typeof AnimationPresets.MONITORING] ): NodeModel— Apply a workflow preset to a node Convenient wrapper that modifies the node in placegetLinkAnimationFromPreset( preset: typeof AnimationPresets.WORKFLOW[keyof typeof AnimationPresets.WORKFLOW] | typeof AnimationPresets.ETL[keyof typeof AnimationPresets.ETL] | typeof AnimationPresets.DATA_FLOW[keyof typeof AnimationPresets.DATA_FLOW] | typeof AnimationPresets.CONNECTION[keyof typeof AnimationPresets.CONNECTION] ): any— Get link animation from a preset Returns the LinkAnimation configuration from a presetapplyPresetToNodes( nodes: NodeModel[], preset: typeof AnimationPresets.NODE[keyof typeof AnimationPresets.NODE] ): void— Apply animation to multiple nodes at once Convenient batch operationapplyWorkflowPresetToNodes( nodes: NodeModel[], preset: typeof AnimationPresets.WORKFLOW[keyof typeof AnimationPresets.WORKFLOW] | typeof AnimationPresets.ETL[keyof typeof AnimationPresets.ETL] | typeof AnimationPresets.MONITORING[keyof typeof AnimationPresets.MONITORING] ): void— Apply workflow preset to multiple nodes at once Convenient batch operationapplyLinkPresetToLinks( links: LinkModel[], preset: typeof AnimationPresets.DATA_FLOW[keyof typeof AnimationPresets.DATA_FLOW] | typeof AnimationPresets.CONNECTION[keyof typeof AnimationPresets.CONNECTION] ): void— Apply link animation preset to multiple links at once Convenient batch operationngOnDestroy(): void— Angular lifecycle: Clean up on destroy
Was this page helpful?