# friction2d/friction architecture

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

- Interactive diagram: https://gitdiagram.com/friction2d/friction
- Repository: https://github.com/friction2d/friction

## Overview

Friction is a desktop motion-graphics application for creating vector and raster animations for web and video. The principal workflow starts in the main window, edits scenes and animation state in a document, and previews or renders a selected scene; project persistence, effects, expressions, audio, and caching support that work. Relationships are limited to those shown in the README, excerpts, or SOURCE INDEX; several subsystem links are therefore marked dashed and unverified.

Main entry points: [`src/app/GUI/mainwindow.h`](https://github.com/friction2d/friction/blob/main/src/app/GUI/mainwindow.h) (Main Window), [`src/core/canvas.h`](https://github.com/friction2d/friction/blob/main/src/core/canvas.h) (Scene Canvas), [`src/app/renderhandler.cpp`](https://github.com/friction2d/friction/blob/main/src/app/renderhandler.cpp) (Render Handler), [`src/core/Private/document.h`](https://github.com/friction2d/friction/blob/main/src/core/Private/document.h) (Document)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_startup["Application Startup<br/>[main.cpp]"]
  node_main_window["Main Window<br/>[mainwindow.h]"]
  node_layout["Layout Manager<br/>[layouthandler.cpp]"]
end

subgraph group_authoring["Scene Authoring"]
  node_document["Document<br/>[document.h]"]
  node_canvas["Scene Canvas<br/>[canvas.h]"]
  node_timeline["Timeline Editing<br/>[timelinewidget.cpp]"]
  node_animators["Animation Curves<br/>[animator.cpp]"]
  node_expressions["Expressions<br/>[expression.cpp]"]
  node_path_effects["Path Effects<br/>[patheffect.cpp]"]
  node_raster_effects["Raster Effects<br/>[rastereffect.cpp]"]
  node_project_io["Project Import Export<br/>[xevimporter.cpp]"]
end

subgraph group_render["Preview and Render"]
  node_render_handler["Render Handler<br/>[renderhandler.cpp]"]
  node_render_settings["Render Settings UI"]
  node_scene_render_data["Scene Render Data"]
end

subgraph group_support["Runtime Services"]
  node_task_scheduler["Task Scheduler<br/>[taskscheduler.h]"]
  node_frame_cache[("Frame Cache")]
  node_audio["Audio Playback<br/>[audiohandler.cpp]"]
  node_sound_composition["Sound Composition"]
  node_settings["Application Settings<br/>[esettings.h]"]
  node_app_support["Platform Support<br/>[appsupport.h]"]
  node_memory["Memory Handler<br/>[memoryhandler.cpp]"]
end

node_artist(("Artist"))

node_artist -->|"creates animations"| node_startup
node_startup -->|"opens"| node_main_window
node_main_window -->|"uses"| node_document
node_main_window -->|"uses"| node_layout
node_main_window -->|"uses"| node_render_handler
node_document -->|"manages scenes"| node_canvas
node_canvas -->|"uses properties"| node_animators
node_canvas -->|"creates render data"| node_scene_render_data
node_render_handler -->|"updates state"| node_document
node_render_handler -->|"starts playback"| node_audio
node_render_handler -->|"starts scene audio"| node_sound_composition
node_audio -->|"mixes audio"| node_sound_composition
node_render_handler -.->|"schedules work"| node_task_scheduler
node_scene_render_data -.->|"caches frames"| node_frame_cache
node_timeline -.->|"edits animation"| node_animators
node_document -.->|"persists project"| node_project_io
node_canvas -.->|"applies effects"| node_path_effects
node_canvas -.->|"applies effects"| node_raster_effects
node_main_window -.->|"configures output"| node_render_settings
node_main_window -.->|"configures"| node_settings
node_startup -.->|"initializes platform"| node_app_support
node_memory -.->|"limits work"| node_task_scheduler
node_expressions -.->|"binds values"| node_animators

click node_startup "https://github.com/friction2d/friction/blob/main/src/app/main.cpp"
click node_main_window "https://github.com/friction2d/friction/blob/main/src/app/GUI/mainwindow.h"
click node_layout "https://github.com/friction2d/friction/blob/main/src/app/GUI/layouthandler.cpp"
click node_document "https://github.com/friction2d/friction/blob/main/src/core/Private/document.h"
click node_canvas "https://github.com/friction2d/friction/blob/main/src/core/canvas.h"
click node_timeline "https://github.com/friction2d/friction/blob/main/src/app/GUI/timelinewidget.cpp"
click node_animators "https://github.com/friction2d/friction/blob/main/src/core/Animators/animator.cpp"
click node_expressions "https://github.com/friction2d/friction/blob/main/src/core/Expressions/expression.cpp"
click node_path_effects "https://github.com/friction2d/friction/blob/main/src/core/PathEffects/patheffect.cpp"
click node_raster_effects "https://github.com/friction2d/friction/blob/main/src/core/RasterEffects/rastereffect.cpp"
click node_project_io "https://github.com/friction2d/friction/blob/main/src/core/XML/xevimporter.cpp"
click node_render_handler "https://github.com/friction2d/friction/blob/main/src/app/renderhandler.cpp"
click node_render_settings "https://github.com/friction2d/friction/blob/main/src/app/GUI/RenderWidgets/rendersettingsdialog.cpp"
click node_scene_render_data "https://github.com/friction2d/friction/blob/main/src/core/Boxes/canvasrenderdata.cpp"
click node_task_scheduler "https://github.com/friction2d/friction/blob/main/src/core/Private/Tasks/taskscheduler.h"
click node_frame_cache "https://github.com/friction2d/friction/blob/main/src/core/CacheHandlers/sceneframecontainer.cpp"
click node_audio "https://github.com/friction2d/friction/blob/main/src/core/Sound/audiohandler.cpp"
click node_sound_composition "https://github.com/friction2d/friction/blob/main/src/core/Sound/soundcomposition.cpp"
click node_settings "https://github.com/friction2d/friction/blob/main/src/core/Private/esettings.h"
click node_app_support "https://github.com/friction2d/friction/blob/main/src/core/appsupport.h"
click node_memory "https://github.com/friction2d/friction/blob/main/src/app/memoryhandler.cpp"

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_startup,node_main_window,node_layout toneBlue
class node_document,node_canvas,node_timeline,node_animators,node_expressions,node_path_effects,node_raster_effects,node_project_io toneAmber
class node_render_handler,node_render_settings,node_scene_render_data toneMint
class node_task_scheduler,node_frame_cache,node_audio,node_sound_composition,node_settings,node_app_support,node_memory toneRose
class node_artist toneIndigo
```

## Components

### Application UI

- [Application Startup](https://github.com/friction2d/friction/blob/main/src/app/main.cpp): `src/app/main.cpp`
- [Main Window](https://github.com/friction2d/friction/blob/main/src/app/GUI/mainwindow.h): `src/app/GUI/mainwindow.h`
- [Layout Manager](https://github.com/friction2d/friction/blob/main/src/app/GUI/layouthandler.cpp): `src/app/GUI/layouthandler.cpp`

### Scene Authoring

- [Document](https://github.com/friction2d/friction/blob/main/src/core/Private/document.h): `src/core/Private/document.h`
- [Scene Canvas](https://github.com/friction2d/friction/blob/main/src/core/canvas.h): `src/core/canvas.h`
- [Timeline Editing](https://github.com/friction2d/friction/blob/main/src/app/GUI/timelinewidget.cpp): `src/app/GUI/timelinewidget.cpp`
- [Animation Curves](https://github.com/friction2d/friction/blob/main/src/core/Animators/animator.cpp): `src/core/Animators/animator.cpp`
- [Expressions](https://github.com/friction2d/friction/blob/main/src/core/Expressions/expression.cpp): `src/core/Expressions/expression.cpp`
- [Path Effects](https://github.com/friction2d/friction/blob/main/src/core/PathEffects/patheffect.cpp): `src/core/PathEffects/patheffect.cpp`
- [Raster Effects](https://github.com/friction2d/friction/blob/main/src/core/RasterEffects/rastereffect.cpp): `src/core/RasterEffects/rastereffect.cpp`
- [Project Import Export](https://github.com/friction2d/friction/blob/main/src/core/XML/xevimporter.cpp): `src/core/XML/xevimporter.cpp`

### Preview and Render

- [Render Handler](https://github.com/friction2d/friction/blob/main/src/app/renderhandler.cpp): `src/app/renderhandler.cpp`
- [Render Settings UI](https://github.com/friction2d/friction/blob/main/src/app/GUI/RenderWidgets/rendersettingsdialog.cpp): `src/app/GUI/RenderWidgets/rendersettingsdialog.cpp`
- [Scene Render Data](https://github.com/friction2d/friction/blob/main/src/core/Boxes/canvasrenderdata.cpp): `src/core/Boxes/canvasrenderdata.cpp`

### Runtime Services

- [Task Scheduler](https://github.com/friction2d/friction/blob/main/src/core/Private/Tasks/taskscheduler.h): `src/core/Private/Tasks/taskscheduler.h`
- [Frame Cache](https://github.com/friction2d/friction/blob/main/src/core/CacheHandlers/sceneframecontainer.cpp): `src/core/CacheHandlers/sceneframecontainer.cpp`
- [Audio Playback](https://github.com/friction2d/friction/blob/main/src/core/Sound/audiohandler.cpp): `src/core/Sound/audiohandler.cpp`
- [Sound Composition](https://github.com/friction2d/friction/blob/main/src/core/Sound/soundcomposition.cpp): `src/core/Sound/soundcomposition.cpp`
- [Application Settings](https://github.com/friction2d/friction/blob/main/src/core/Private/esettings.h): `src/core/Private/esettings.h`
- [Platform Support](https://github.com/friction2d/friction/blob/main/src/core/appsupport.h): `src/core/appsupport.h`
- [Memory Handler](https://github.com/friction2d/friction/blob/main/src/app/memoryhandler.cpp): `src/app/memoryhandler.cpp`

### Other components

- **Artist**

## Connections

- Artist → Application Startup: creates animations (evidence: `README.md`)
- Application Startup → Main Window: opens (evidence: `src/app/main.cpp`)
- Main Window → Document: uses (evidence: `src/app/GUI/mainwindow.h`)
- Main Window → Layout Manager: uses (evidence: `src/app/GUI/mainwindow.h`)
- Main Window → Render Handler: uses (evidence: `src/app/GUI/mainwindow.h`)
- Document → Scene Canvas: manages scenes (evidence: `src/core/Private/document.h`)
- Scene Canvas → Animation Curves: uses properties (evidence: `src/core/canvas.h`)
- Scene Canvas → Scene Render Data: creates render data (evidence: `src/core/canvas.h`)
- Render Handler → Document: updates state (evidence: `src/app/renderhandler.cpp`)
- Render Handler → Audio Playback: starts playback (evidence: `src/app/renderhandler.cpp`)
- Render Handler → Sound Composition: starts scene audio (evidence: `src/app/renderhandler.cpp`)
- Audio Playback → Sound Composition: mixes audio (evidence: `src/core/Sound/audiohandler.cpp`)
- Render Handler → Task Scheduler: schedules work (evidence: `src/app/renderhandler.cpp`)
- Scene Render Data → Frame Cache: caches frames
- Timeline Editing → Animation Curves: edits animation
- Document → Project Import Export: persists project
- Scene Canvas → Path Effects: applies effects
- Scene Canvas → Raster Effects: applies effects
- Main Window → Render Settings UI: configures output
- Main Window → Application Settings: configures
- Application Startup → Platform Support: initializes platform (evidence: `src/app/main.cpp`)
- Memory Handler → Task Scheduler: limits work
- Expressions → Animation Curves: binds values
