How annulusgames/litmotion works
Main Components
– Motion/Tween creation APIs (LMotion.Create, LMotion.Punch, etc.)
– Runtime execution and scheduling (e.g. MotionScheduler, UpdateRunner, MotionManager)
– Internal helper utilities (collections, easing functions, interpolation, update loops)
• Editor Integration Module – This contains all editor-specific code:
– Editor scripts and custom inspectors (e.g. MotionDebuggerWindow, EditorMotionScheduler)
– Tools for displaying and managing motions inside the Unity Editor
• Extensions/Adapters Module – This part provides support for additional functionalities and external integrations:
– Extensions for Unity components (e.g. Transform, TextMeshPro, UI, Renderer)
– Integration/adapters for external libraries like UniTask (async/await support), UniRx (Observable support), and R3.
• Animation Package (LitMotion.Animation) – A specialized submodule that hooks into the main library:
– Contains its own runtime and editor folders.
– Provides functionality to build animations directly from the Inspector.
• Documentation & Samples – Though not part of the runtime, the docs and sample directories are crucial:
– Docs folder with articles, usage guides, and DocFX configuration.
– Samples directory that holds demo Unity projects showing practical usage of the library.
Relationships and Data Flow
• The application (Unity game or scene) uses the LitMotion API to create motions (tweens).
• Inside the Core Tween Engine, motions are scheduled via modules like MotionScheduler and executed based on Unity’s update loop. The engine is designed for zero allocation with a focus on performance.
– Illustrate data flow from “Tween Creation API” → “MotionQueue/Scheduler” → “Update / Player Loop”
• The Editor Integration module interacts back with the core engine for debug displays and configuration:
• The Extensions/Adapters module wraps around core functionality to provide additional binding for various Unity components and support third-party integrations.
• The Animation Package module (LitMotion.Animation) bridges between the Inspector (Unity Editor) and the core tween engine:
Architectural Patterns and Design Principles
• Zero Allocation / Performance-Optimized – Indicate that the core engine uses a struct-based, DOTS-inflected design that minimizes allocations.
• Integration Points – Emphasize adapters and extension points (IMotionAdapter, IMotionOptions) thus making the library extensible.
• Separation of concerns – Runtime code is separated from editor code and sample/demo projects.
Relevant Technologies and Dependencies
• Unity (runtime, editor environment, scene components)
• Burst Compiler, Collections, Mathematics packages (as prerequisites)
• External libraries: UniTask, UniRx, and R3. Show links from Extensions/Adapters to these libraries.
• DocFX in the docs folder for generating documentation.