# therangerstar/androidanimation architecture

> Architecture diagram of the GitHub repository therangerstar/androidanimation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/therangerstar/androidanimation
- Repository: https://github.com/therangerstar/androidanimation

## Overview

1. This is a single-module Android application under `app/`, built with Kotlin and Jetpack Compose. There is no backend or multi-module service boundary; the whole product is an on-device visual animation app.

2. The app entry point is `MainActivity`, which likely sets up the Compose content and acts as the host for the main navigation flow. The visible UI surface is split into a home screen (`HomePage`) and an animation detail screen (`AnimationDetailPage`).

3. The core rendering subsystem is `StrangeParticleAnimation`. Based on the README and file names, this is the main high-performance drawing layer, using Compose Canvas/native canvas techniques to render large particle fields and wave/path effects.

4. The animation engine is model-driven rather than hard-coded to one effect. The repository includes multiple mathematical scenes: Lorenz, Aizawa, Halvorsen, Sprott B, Fibonacci sphere, Nebula Cloud, and Water Ripple. These are likely selected from the UI and rendered by the same animation pipeline with different parameters.

5. Interaction is part of the rendering boundary, not a separate subsystem. The README indicates direct manipulation through single-finger rotation, pinch zoom, sliders, HSV color selection, particle size control, and water-level adjustment. Those inputs feed the animation state in real time.

6. `AttractorViewModel` is the central state holder and orchestration layer. It likely owns the currently selected animation, runtime parameters, and user preferences, and exposes that state to Compose screens. This is the main MVVM boundary between UI and animation/data logic.

7. Persistence is handled locally through Room. `data/Database.kt` is the storage boundary for saving per-animation settings so each animation can restore its last-used configuration on app launch. There is no network sync; state is device-local.

8. The UI theming layer is isolated in `ui/theme/` with standard Compose theme files (`Color.kt`, `Theme.kt`, `Type.kt`). This keeps visual styling separate from animation logic and allows the app to maintain a consistent dark, immersive look.

9. The project includes Android resources for launcher assets, app strings, colors, and theme definitions, plus XML backup/data-extraction rules. These are supporting platform assets rather than business logic, but they matter for app packaging and device behavior.

10. Build and release are managed with Gradle Kotlin DSL (`build.gradle.kts`, `settings.gradle.kts`, version catalog). The presence of `release/` APK artifacts and baseline profile files suggests release optimization work, especially for startup/performance of the animation-heavy UI.

11. Test coverage exists only as default skeletons in `src/test` and `src/androidTest`, so the main architectural behavior is currently concentrated in the UI, ViewModel, rendering, and local persistence layers.

12. In diagram form, the key flow is: user input in Compose screens → ViewModel state updates → animation renderer reads parameters and draws frames → Room persists configuration changes → next launch restores saved settings. That is the central architecture of the repository.

Main entry points: [`app/src/main/java/com/therangerstar/animation/AttractorViewModel.kt`](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/AttractorViewModel.kt) (Attractor VM), [`app/src/main/java/com/therangerstar/animation/ui/theme/Theme.kt`](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/ui/theme/Theme.kt) (Compose Theme), [`app/src/main/java/com/therangerstar/animation/StrangeParticleAnimation.kt`](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/StrangeParticleAnimation.kt) (Particle Renderer), [`app/src/main/java/com/therangerstar/animation/MainActivity.kt`](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/MainActivity.kt) (MainActivity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_app["App core"]
  node_main_activity["MainActivity<br/>entry activity<br/>[MainActivity.kt]"]
  node_home_page["Home Page<br/>compose screen<br/>[HomePage.kt]"]
  node_detail_page["Detail Page<br/>compose screen"]
  node_view_model["Attractor VM<br/>state holder"]
end

subgraph group_group_render["Rendering"]
  node_renderer{{"Particle Renderer<br/>canvas engine"}}
  node_scenes(("Scene Presets<br/>animation models"))
  node_controls(("Interaction Controls<br/>input mapping"))
end

subgraph group_group_data["Local data"]
  node_database[("Database<br/>[Database.kt]")]
  node_settings["Saved Settings<br/>config store"]
end

subgraph group_group_ui["UI system"]
  node_theme["Compose Theme<br/>ui theme<br/>[Theme.kt]"]
  node_colors["Theme Colors<br/>palette<br/>[Color.kt]"]
  node_typography["Theme Type<br/>typography<br/>[Type.kt]"]
end

subgraph group_group_platform["Platform"]
  node_manifest["Manifest"]
  node_resources["Resources"]
end

subgraph group_group_build["Build"]
  node_build["Gradle Build<br/>build config<br/>[build.gradle.kts]"]
  node_versions["Version Catalog<br/>dependency catalog<br/>[libs.versions.toml]"]
  node_release["Release Assets<br/>artifact outputs"]
end

node_manifest -->|"launches"| node_main_activity
node_main_activity -->|"applies"| node_theme
node_main_activity -->|"starts"| node_home_page
node_home_page -->|"reads state"| node_view_model
node_home_page -->|"navigates"| node_detail_page
node_detail_page -->|"binds controls"| node_view_model
node_view_model -->|"selects"| node_scenes
node_view_model -->|"updates"| node_controls
node_controls -->|"drives"| node_renderer
node_scenes -->|"renders with"| node_renderer
node_view_model -->|"configures"| node_renderer
node_renderer -->|"responds to"| node_controls
node_view_model -->|"persists to"| node_database
node_database -->|"stores"| node_settings
node_settings -->|"restores"| node_view_model
node_theme -->|"uses"| node_colors
node_theme -->|"uses"| node_typography
node_resources -->|"supports"| node_theme
node_build -->|"depends on"| node_versions
node_build -->|"produces"| node_release

click node_main_activity "https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/MainActivity.kt"
click node_home_page "https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/HomePage.kt"
click node_detail_page "https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/AnimationDetailPage.kt"
click node_view_model "https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/AttractorViewModel.kt"
click node_renderer "https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/StrangeParticleAnimation.kt"
click node_database "https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/data/Database.kt"
click node_theme "https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/ui/theme/Theme.kt"
click node_colors "https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/ui/theme/Color.kt"
click node_typography "https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/ui/theme/Type.kt"
click node_manifest "https://github.com/therangerstar/androidanimation/blob/main/app/src/main/AndroidManifest.xml"
click node_resources "https://github.com/therangerstar/androidanimation/tree/main/app/src/main/res"
click node_build "https://github.com/therangerstar/androidanimation/blob/main/build.gradle.kts"
click node_versions "https://github.com/therangerstar/androidanimation/blob/main/gradle/libs.versions.toml"
click node_release "https://github.com/therangerstar/androidanimation/tree/main/app/release"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main_activity,node_home_page,node_detail_page,node_view_model toneBlue
class node_renderer,node_scenes,node_controls toneAmber
class node_database,node_settings toneMint
class node_theme,node_colors,node_typography toneRose
class node_manifest,node_resources toneIndigo
class node_build,node_versions,node_release toneTeal
```

## Components

### App core

Entry activity, screens, and shared state orchestration.

- [MainActivity](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/MainActivity.kt): entry activity · Android app entry point and host for the main Compose flow. · `app/src/main/java/com/therangerstar/animation/MainActivity.kt`
- [Home Page](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/HomePage.kt): compose screen · Landing screen for choosing or browsing animation scenes. · `app/src/main/java/com/therangerstar/animation/HomePage.kt`
- [Detail Page](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/AnimationDetailPage.kt): compose screen · Animation detail and control screen for the selected scene. · `app/src/main/java/com/therangerstar/animation/AnimationDetailPage.kt`
- [Attractor VM](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/AttractorViewModel.kt): state holder · Central MVVM layer that owns selected animation and runtime parameters. · `app/src/main/java/com/therangerstar/animation/AttractorViewModel.kt`

### Rendering

High-performance Compose animation engine and scene models.

- [Particle Renderer](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/StrangeParticleAnimation.kt): canvas engine · Main Compose drawing layer for particles, waves, and path effects. · `app/src/main/java/com/therangerstar/animation/StrangeParticleAnimation.kt`
- **Scene Presets**: animation models · Mathematical scene set such as Lorenz, Aizawa, Halvorsen, Sprott B, Fibonacci sphere, Nebula Cloud, and Water Ripple.
- **Interaction Controls**: input mapping · Gesture and slider-driven adjustments for rotation, zoom, color, size, and water level.

### Local data

Device-local persistence for animation configuration.

- [Database](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/data/Database.kt): room database · Local persistence boundary for storing animation settings. · `app/src/main/java/com/therangerstar/animation/data/Database.kt`
- **Saved Settings**: config store · Per-animation configuration restored on app launch.

### UI system

Compose theming and screen presentation layer.

- [Compose Theme](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/ui/theme/Theme.kt): ui theme · Shared dark, immersive styling for the app screens. · `app/src/main/java/com/therangerstar/animation/ui/theme/Theme.kt`
- [Theme Colors](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/ui/theme/Color.kt): palette · Theme color definitions used by the Compose theme. · `app/src/main/java/com/therangerstar/animation/ui/theme/Color.kt`
- [Theme Type](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/java/com/therangerstar/animation/ui/theme/Type.kt): typography · Font and text styling definitions for the Compose theme. · `app/src/main/java/com/therangerstar/animation/ui/theme/Type.kt`

### Platform

Android manifest and resource packaging support.

- [Manifest](https://github.com/therangerstar/androidanimation/blob/main/app/src/main/AndroidManifest.xml): android manifest · Application declaration, entry configuration, and platform wiring. · `app/src/main/AndroidManifest.xml`
- [Resources](https://github.com/therangerstar/androidanimation/tree/main/app/src/main/res): android resources · Strings, colors, drawables, and XML packaging assets. · `app/src/main/res`

### Build

Gradle and release-time build artifacts.

- [Gradle Build](https://github.com/therangerstar/androidanimation/blob/main/build.gradle.kts): build config · Project and app module build configuration. · `build.gradle.kts`
- [Version Catalog](https://github.com/therangerstar/androidanimation/blob/main/gradle/libs.versions.toml): dependency catalog · Centralized dependency and plugin version definitions. · `gradle/libs.versions.toml`
- [Release Assets](https://github.com/therangerstar/androidanimation/tree/main/app/release): artifact outputs · Packaged APK and baseline profile outputs for performance-tuned releases. · `app/release`

## Connections

- Manifest → MainActivity: launches · Declares the application entry activity.
- MainActivity → Compose Theme: applies · Wraps the Compose UI in the shared app theme.
- MainActivity → Home Page: starts · Hosts the main navigation flow on the home screen.
- Home Page → Attractor VM: reads state · Uses shared view-model state to present available scenes.
- Home Page → Detail Page: navigates · Opens the animation detail screen for a chosen scene.
- Detail Page → Attractor VM: binds controls · Shows and edits runtime parameters through the central state layer.
- Attractor VM → Scene Presets: selects · Chooses which mathematical scene is active.
- Attractor VM → Interaction Controls: updates · Receives gesture and UI control changes in real time.
- Interaction Controls → Particle Renderer: drives · Feeds interaction changes into rendering parameters.
- Scene Presets → Particle Renderer: renders with · Provides model-specific parameters and geometry for drawing.
- Attractor VM → Particle Renderer: configures · Pushes the active animation state into the drawing pipeline.
- Particle Renderer → Interaction Controls: responds to · Uses live interaction state while animating and drawing.
- Attractor VM → Database: persists to · Saves configuration changes locally.
- Database → Saved Settings: stores · Persists animation settings on-device.
- Saved Settings → Attractor VM: restores · Reloads the last-used configuration when the app starts.
- Compose Theme → Theme Colors: uses · Composes the shared color palette.
- Compose Theme → Theme Type: uses · Composes the shared text styles.
- Resources → Compose Theme: supports · Provides packaged assets and app-level visual resources.
- Gradle Build → Version Catalog: depends on · Uses the version catalog for dependency management.
- Gradle Build → Release Assets: produces · Generates optimized release artifacts and baseline profile outputs.
