Hylograph.Internal.Transition.Manager
- Package
- purescript-hylograph-selection
- Repository
- afcondon/purescript-hylograph-selection
Element Transition Manager
Manages per-element attribute animations using the pure transition engine.
This module bridges the AnimatedAttr type from the DSL to the actual
animation execution via the Coordinator.
Key responsibilities:
- Track active transitions per element/attribute pair
- Handle interruption (new transition cancels existing one for same target)
- Provide tick function for Coordinator integration
- Clean up completed transitions
Usage:
import Hylograph.Internal.Transition.Manager as Manager
-- Create a manager
manager <- Manager.create
-- Register a transition
Manager.registerTransition manager element "opacity"
{ from: 0.0, to: 1.0, duration: 500.0, easing: QuadOut, delay: 0.0 }
-- Convert to Coordinator consumer
let consumer = Manager.toCoordinatorConsumer manager
Coordinator.register coordinator { tick: consumer, onComplete: pure unit }
#ElementTransitionManager Source
newtype ElementTransitionManagerThe Element Transition Manager
#TransitionId Source
#TransitionSpec Source
type TransitionSpec = { delay :: Milliseconds, duration :: Milliseconds, easing :: EasingType, from :: Number, to :: Number }Specification for a single-value transition
#CompoundTransitionSpec Source
type CompoundTransitionSpec = { delay :: Milliseconds, duration :: Milliseconds, easing :: EasingType, fromValues :: Array Number, generator :: Array Number -> String, toValues :: Array Number }Specification for a compound transition (multiple values → generated string) Used for paths where we animate sourceX, sourceY, targetX, targetY and regenerate the path string on each frame
#Milliseconds Source
type Milliseconds = NumberMilliseconds type alias
#create Source
create :: Effect ElementTransitionManagerCreate a new transition manager
#registerTransition Source
registerTransition :: ElementTransitionManager -> Element -> String -> TransitionSpec -> Effect TransitionIdRegister a transition for an element attribute
If a transition already exists for the same element/attribute pair, it will be interrupted (replaced) by this new transition.
Returns the transition ID.
#registerAnimatedAttr Source
registerAnimatedAttr :: forall datum. ElementTransitionManager -> Element -> datum -> Int -> String -> Maybe (AnimatedValue datum) -> AnimatedValue datum -> AnimationConfig -> Effect Unit -> Effect TransitionIdRegister an animated attribute for an element
Evaluates the AnimatedValue specifications with the datum and index, creates a TransitionSpec, and registers the transition.
#registerAnimatedCompound Source
registerAnimatedCompound :: forall datum. ElementTransitionManager -> Element -> datum -> Int -> String -> Array (AnimatedValue datum) -> Array (AnimatedValue datum) -> (Array Number -> String) -> AnimationConfig -> Effect Unit -> Effect TransitionIdRegister a compound animated attribute (for paths and other generated values)
Evaluates the AnimatedValue arrays for from/to values, and registers a compound transition that interpolates all values and calls the generator to produce the final string value on each frame.
#toCoordinatorConsumer Source
toCoordinatorConsumer :: ElementTransitionManager -> Milliseconds -> Effect TickResultConvert to a Coordinator-compatible consumer tick function
#tick Source
tick :: ElementTransitionManager -> Milliseconds -> Effect (Array TransitionId)Process a single tick, advancing all transitions
Returns array of completed transition IDs
#activeCount Source
activeCount :: ElementTransitionManager -> Effect IntGet the number of active transitions
- Modules
- Data.
DependencyGraph - Hylograph.
AST - Hylograph.
Axis. Axis - Hylograph.
Brush - Hylograph.
Brush. FFI - Hylograph.
Brush. Types - Hylograph.
Classify - Hylograph.
Data. Graph - Hylograph.
Data. Graph. Algorithms - Hylograph.
Data. Node - Hylograph.
Data. Tree - Hylograph.
Expr. Animation - Hylograph.
Expr. Attr - Hylograph.
Expr. Datum - Hylograph.
Expr. Expr - Hylograph.
Expr. Friendly - Hylograph.
Expr. Integration - Hylograph.
Expr. Interpreter. CodeGen - Hylograph.
Expr. Interpreter. Eval - Hylograph.
Expr. Interpreter. Meta - Hylograph.
Expr. Interpreter. PureSVG - Hylograph.
Expr. Interpreter. SVG - Hylograph.
Expr. Path - Hylograph.
Expr. Path. Generators - Hylograph.
Expr. Sugar - Hylograph.
Expr. Units - Hylograph.
HATS - Hylograph.
HATS. Friendly - Hylograph.
HATS. InterpreterTick - Hylograph.
HATS. Transitions - Hylograph.
Interaction. Brush - Hylograph.
Interaction. Coordinated - Hylograph.
Interaction. Pointer - Hylograph.
Interaction. Zoom - Hylograph.
Internal. Attribute - Hylograph.
Internal. Behavior. FFI - Hylograph.
Internal. Behavior. Types - Hylograph.
Internal. Capabilities. Selection - Hylograph.
Internal. Capabilities. Transition - Hylograph.
Internal. FFI - Hylograph.
Internal. Selection. Join - Hylograph.
Internal. Selection. Operations - Hylograph.
Internal. Selection. Operations. Conversions - Hylograph.
Internal. Selection. Operations. Helpers - Hylograph.
Internal. Selection. Operations. Selection - Hylograph.
Internal. Selection. Query - Hylograph.
Internal. Selection. Types - Hylograph.
Internal. Transition. FFI - Hylograph.
Internal. Transition. Manager - Hylograph.
Internal. Transition. Scene - Hylograph.
Internal. Transition. Types - Hylograph.
Internal. Types - Hylograph.
Interpreter. D3 - Hylograph.
Interpreter. English - Hylograph.
Interpreter. Mermaid - Hylograph.
Interpreter. MetaAST - Hylograph.
Interpreter. SemiQuine - Hylograph.
Interpreter. SemiQuine. TreeToCode - Hylograph.
Interpreter. SemiQuine. Types - Hylograph.
Render - Hylograph.
Scale - Hylograph.
Scale. FP - Hylograph.
Shape. Arc - Hylograph.
Shape. Pie - Hylograph.
Shape. Polygon - Hylograph.
Tooltip - Hylograph.
Transform - Hylograph.
TreeDSL - Hylograph.
TreeDSL. ShapeTree - Hylograph.
Unified - Hylograph.
Unified. Attribute - Hylograph.
Unified. DataDSL - Hylograph.
Unified. Display - Hylograph.
Unified. Examples - Hylograph.
Unified. Join - Hylograph.
Unified. Sugar