Skip to content
D
Documentation

AngularAnimationService

reference
1 min readUpdated

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

NameTypeDefaultDescription
presetsExport presets for easy access

Methods

  • constructor()
  • setEnabled(enabled: boolean): void — Enable or disable all animations globally
  • getConfig(): Readonly<AnimationConfig> — Get current configuration
  • updateConfig(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 node
  • getAnimationDuration(baseDuration: number): number — Calculate animation duration with speed multiplier applied
  • pauseAllAnimations(): void — Pause all animations (for debugging or screenshots)
  • resumeAllAnimations(): void — Resume all animations
  • onConfigChange(listener: (config: AnimationConfig) => void): () => void — Add listener for configuration changes
  • resetConfig(): void — Reset configuration to defaults
  • injectCSS(): void — Inject animation CSS into the document
  • removeCSS(): void — Remove injected animation CSS from the document
  • isCSSInjected(): boolean — Check if CSS has been injected
  • applyNodePreset( 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 place
  • applyWorkflowPreset( 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 place
  • getLinkAnimationFromPreset( 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 preset
  • applyPresetToNodes( nodes: NodeModel[], preset: typeof AnimationPresets.NODE[keyof typeof AnimationPresets.NODE] ): void — Apply animation to multiple nodes at once Convenient batch operation
  • applyWorkflowPresetToNodes( 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 operation
  • applyLinkPresetToLinks( 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 operation
  • ngOnDestroy(): void — Angular lifecycle: Clean up on destroy

Was this page helpful?

AngularAnimationService — Grafloria