Complete Directive Reference

Ecosistema completo para organización y gestión de contenido con interfaces espaciales

📚 Complete Flash Animations Directive Reference

Comprehensive reference for all flash-animations directives and properties


🎨 All Directives Overview

Directive Purpose Trigger Use Case
FlashAnimateDirective Basic animations Page load, trigger General purpose
FlashAnimateInteractionDirective User interactions Click, hover, focus Interactive elements
FlashAnimateViewportDirective Scroll animations Viewport intersection Progressive reveals
FlashAnimateComponentDirective Route override Navigation Dynamic route animation
FlashAnimationConfigDirective Complete config Configurable Advanced control

🎯 FlashAnimateDirective

Selector: [flashAnim]

Basic Usage

<div flashAnim="fade-in" 
     flashAnimSpeed="fast">
  Basic animation
</div>

All Properties

// Animation
@Input() flashAnim: FlashAnimationPreset = 'fade-in';

// Timing
@Input() flashAnimSpeed: FlashAnimationSpeed = 'normal';
@Input() flashAnimDelay: number = 0;
@Input() flashAnimDuration?: number;
@Input() flashAnimEasing?: string;

// Repetition  
@Input() flashAnimRepeat: number = 1;
@Input() flashAnimDirection: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse' = 'normal';
@Input() flashAnimFillMode: 'none' | 'forwards' | 'backwards' | 'both' = 'both';

// Control
@Input() flashAnimEnabled: boolean = true;
@Input() flashAnimTrigger: any = null;  // Change to re-trigger

Advanced Examples

<!-- Looping floating animation -->
<div flashAnim="float"
     [flashAnimRepeat]="999"
     flashAnimDirection="alternate"
     flashAnimSpeed="slow">
  Floating element
</div>

<!-- Custom easing with delay -->
<div flashAnim="morph"
     [flashAnimDelay]="500"
     flashAnimEasing="cubic-bezier(0.68, -0.55, 0.265, 1.55)"
     flashAnimSpeed="elegant">
  Custom morphing
</div>

<!-- Triggered animation -->
<div flashAnim="scatter"
     [flashAnimTrigger]="buttonClicked"
     flashAnimDirection="reverse">
  Triggers when buttonClicked changes
</div>

🖱️ FlashAnimateInteractionDirective

Selector: [flashAnimClick],[flashAnimHover],[flashAnimFocus]

Interaction Types

// Click animations
@Input() flashAnimClick?: FlashAnimationPreset;

// Hover animations  
@Input() flashAnimHover?: FlashAnimationPreset;
@Input() flashAnimExit?: FlashAnimationPreset;  // Mouse leave

// Focus animations
@Input() flashAnimFocus?: FlashAnimationPreset;
@Input() flashAnimBlur?: FlashAnimationPreset;

// Timing controls (same as FlashAnimateDirective)
@Input() flashAnimSpeed: FlashAnimationSpeed = 'fast';
@Input() flashAnimDelay: number = 0;
@Input() flashAnimDuration?: number;
@Input() flashAnimEasing?: string;
@Input() flashAnimRepeat: number = 1;
@Input() flashAnimDirection: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse' = 'normal';
@Input() flashAnimFillMode: 'none' | 'forwards' | 'backwards' | 'both' = 'both';
@Input() flashAnimEnabled: boolean = true;

Examples

<!-- Rich interactive button -->
<button flashAnimClick="explode"
        flashAnimHover="float"
        flashAnimFocus="glow"
        flashAnimSpeed="elegant"
        [flashAnimRepeat]="2">
  Amazing Button
</button>

<!-- Card with custom interactions -->
<div flashAnimHover="morph"
     flashAnimExit="fade-out"
     flashAnimClick="vortex"
     [flashAnimDelay]="100"
     flashAnimDirection="alternate">
  Interactive Card
</div>

<!-- Form field with validation feedback -->
<input flashAnimFocus="spotlight"
       flashAnimBlur="fade-out"
       [flashAnimClick]="hasError ? 'shake' : 'pulse'"
       flashAnimSpeed="fast">

👁️ FlashAnimateViewportDirective

Selector: [flashAnimViewport]

Scroll-Based Animations

// Animation
@Input() flashAnimViewport!: FlashAnimationPreset;

// Intersection Observer options
@Input() flashAnimThreshold: number = 0.2;      // 0-1, when to trigger
@Input() flashAnimRootMargin: string = '0px';   // Margin around root
@Input() flashAnimTriggerOnce: boolean = true;  // Trigger only once

// Timing controls (same as other directives)
@Input() flashAnimSpeed: FlashAnimationSpeed = 'normal';
@Input() flashAnimDelay: number = 0;
@Input() flashAnimDuration?: number;
@Input() flashAnimEasing?: string;
@Input() flashAnimRepeat: number = 1;
@Input() flashAnimDirection: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse' = 'normal';
@Input() flashAnimFillMode: 'none' | 'forwards' | 'backwards' | 'both' = 'both';
@Input() flashAnimEnabled: boolean = true;

// Events
@Output() flashAnimEnter = output<void>();      // When enters viewport
@Output() flashAnimExit = output<void>();       // When exits viewport

Examples

<!-- Staggered card reveals -->
@for (card of cards; track card.id; let i = $index) {
  <div flashAnimViewport="unfold"
       [flashAnimThreshold]="0.3"
       [flashAnimDelay]="i * 150"
       flashAnimSpeed="elegant"
       (flashAnimEnter)="onCardVisible(card)">
    {{ card.title }}
  </div>
}

<!-- Repeating attention grabber -->
<div flashAnimViewport="float"
     [flashAnimRepeat]="3"
     flashAnimDirection="alternate"
     [flashAnimTriggerOnce]="false">
  Floats when in view
</div>

<!-- Progressive content reveal -->
<section flashAnimViewport="spotlight"
         [flashAnimThreshold]="0.8"
         flashAnimSpeed="slow"
         flashAnimRootMargin="-100px">
  Revealed with spotlight when 80% visible
</section>

🎮 FlashAnimateComponentDirective

Selector: [flashRouteAnimation]

Component-Level Route Control

// Route animation override
@Input() flashRouteAnimation: RouteAnimationType = 'elegant';
@Input() flashRouteAnimationSpeed: RouteAnimationSpeed = 'normal';
@Input() flashRouteAnimationEnabled: boolean = true;

Examples

<!-- Static override -->
<user-dashboard flashRouteAnimation="cube">
  Always uses cube animation
</user-dashboard>

<!-- Dynamic override -->
<content-viewer [flashRouteAnimation]="getAnimationForContent()"
                [flashRouteAnimationSpeed]="userSpeed()">
  Animation changes based on content type
</content-viewer>

<!-- Conditional override -->
<premium-section [flashRouteAnimation]="isPremium ? 'explode' : 'elegant'"
                [flashRouteAnimationEnabled]="animationsEnabled()">
  Premium users get explode animation
</premium-section>

⚙️ FlashAnimationConfigDirective

Selector: [flashAnimConfig]

Configuration Interface

interface FlashAnimationConfig {
  preset: FlashAnimationPreset;           // Required
  speed?: FlashAnimationSpeed;            // 'instant' | 'fast' | 'normal' | 'slow' | 'elegant'
  delay?: number;                         // Delay in milliseconds
  duration?: number;                      // Duration in milliseconds
  easing?: string;                        // CSS easing function
  repeat?: number;                        // Iterations (999 = infinite)
  direction?: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
  fillMode?: 'none' | 'forwards' | 'backwards' | 'both';
  trigger?: any;                          // Re-trigger value
  enabled?: boolean;                      // Enable/disable
  onStart?: () => void;                   // Start callback
  onComplete?: () => void;                // Complete callback
  onCancel?: () => void;                  // Cancel callback
}

Examples

<!-- Simple config -->
<div [flashAnimConfig]="{ preset: 'morph', speed: 'fast' }">
  Simple morphing
</div>

<!-- Complex config -->
<div [flashAnimConfig]="{
  preset: 'vortex',
  speed: 'elegant', 
  delay: 300,
  repeat: 2,
  direction: 'alternate',
  easing: 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',
  fillMode: 'both',
  onComplete: () => console.log('Animation done!')
}">
  Advanced vortex animation
</div>

<!-- Dynamic config -->
<div [flashAnimConfig]="buildAnimationConfig()">
  Computed configuration
</div>
buildAnimationConfig(): FlashAnimationConfig {
  return {
    preset: this.isSpecial() ? 'explode' : 'fade-in',
    speed: this.userPreferences.speed,
    delay: this.calculateDelay(),
    repeat: this.shouldLoop() ? 999 : 1,
    enabled: this.animationsAllowed()
  };
}

🎯 Cross-Directive Property Consistency

Timing Properties (Available on ALL directives)

flashAnimSpeed: 'instant' | 'fast' | 'normal' | 'slow' | 'elegant'
flashAnimDelay: number              // Delay in ms
flashAnimDuration: number           // Custom duration in ms
flashAnimEasing: string             // CSS easing function
flashAnimRepeat: number             // Iterations (999 = infinite)
flashAnimDirection: string          // Animation direction
flashAnimFillMode: string           // Fill mode
flashAnimEnabled: boolean           // Enable/disable

Animation Presets (Available on ALL directives)

23+ presets work with every directive:

<!-- Same preset, different triggers -->
<div flashAnim="morph">Load animation</div>
<div flashAnimHover="morph">Hover animation</div>  
<div flashAnimViewport="morph">Scroll animation</div>
<div flashAnimClick="morph">Click animation</div>

🧪 Testing Guide

1. Test New Route Animations

// Update a route to test new animations
{
  path: 'test-page',
  data: { animation: 'explode' }  // Try: cube, vortex, spiral, wave
}

2. Test New Element Presets

<!-- Test new presets -->
<div flashAnim="morph">Shape shifting</div>
<div flashAnim="scatter">Particles</div>
<div flashAnim="typewriter">Typing text</div>
<div flashAnim="spotlight">Dramatic reveal</div>

3. Test Dynamic Inputs

<!-- Test component override -->
<my-component [flashRouteAnimation]="'cube'">

<!-- Test config object -->
<div [flashAnimConfig]="{ preset: 'vortex', repeat: 3 }">

4. Test Advanced Timing

<!-- Test complex timing -->
<div flashAnim="explode"
     [flashAnimRepeat]="3"
     flashAnimDirection="alternate"
     [flashAnimDelay]="500">

📊 Summary

Total Available Features

Category Count Examples
Route Animations 17 elegant, cube, explode, wave
Element Presets 23+ morph, scatter, typewriter, spotlight
Timing Controls 8 speed, delay, repeat, easing
Directives 5 Basic, interaction, viewport, component, config
Properties 50+ Complete customization

Flexibility Matrix

17 Route Animations
×
23+ Element Presets  
×
5 Speeds
×
8 Timing Controls
×
5 Directives
=
MILLIONS OF COMBINATIONS! 🎨✨

🎉 What This Enables

✅ User components can specify their own animations
✅ Dynamic animation based on component state
✅ Comprehensive timing control
✅ Consistent API across all directives
✅ All animation presets work everywhere
✅ Perfect for user-generated content
✅ Future Flash Persistence integration ready


Status: ✅ Complete animation system with maximum flexibility!

The most comprehensive Angular animation solution ever built! 🌟