# keijiro/kinoglitch architecture

> Architecture diagram of the GitHub repository keijiro/kinoglitch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/keijiro/kinoglitch
- Repository: https://github.com/keijiro/kinoglitch

## Overview

##### Project Type and Purpose
- The project is a Unity package focused on providing two primary glitch video effects – Analog Glitch and Digital Glitch.
- Its purpose is to offer shaders/effects that can be applied within Unity scenes, making it a reusable tool for developers who want to create glitch effects in video or game projects.

##### File Structure
- The top-level directories include:
- Assets: This is the main folder for Unity projects and contains all game-related assets.
▪ Assets/CalibrationScene: Contains models, materials, and textures used for calibrating or demonstrating the effect in a sample scene.
▪ Assets/Editor: Contains custom editor scripts such as PackageTool.cs which likely packages the asset or facilitates integration into the Unity Editor.
▪ Assets/Kino: Holds the core implementation including glitch effect scripts (AnalogGlitch.cs and DigitalGlitch.cs), corresponding editors, and shader files. This is the core functional part of the project.
▪ Assets/Reaktion: Contains utility scripts that might provide additional functionality or integrations for motion effects.
▪ Assets/Test: Contains a test scene along with appropriate animation and controller files, providing a sample or sandbox environment for the effects.
- ProjectSettings: Stores Unity-specific configuration for inputs, audio, graphics, physics, etc.
- Other files like .gitignore, README.md, and licensing docs.

##### Components and Their Relationships
- Core Glitch Effect Modules:
- Analog Glitch and Digital Glitch within the Assets/Kino directory.
- Their editor tools (found in the Editor subfolders) allow for customization and tweaking directly in Unity’s interface.
- Supporting Utilities:
- Reaktion utilities offer additional features (such as different motion effects) that may interact with or enhance the glitch effects.
- Demonstration/Calibration Scene:
- Assets/CalibrationScene and Assets/Test serve to demonstrate the effects in a controlled environment. These scenes also interact with the core modules to showcase how the effects can be used.
- Project Settings and Configuration:
- ProjectSettings ensures that when the package is used, Unity’s graphics, input, and physics settings are appropriately configured to support these effects.

##### Architectural Patterns and Design Principles
- There is a clear modular separation:
- The core functionality (glitch effects) is separated from the scene demos and editor tools.
- This separation supports reusability and ease of integration as a package in other projects.
- Extensibility is emphasized with separate modules for core effects (Kino) and additional features (Reaktion), along with dedicated editor scripts providing a clear extension point.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Demo and Calibration Scenes (Top Layer)
    subgraph "Demo and Calibration Scenes"
        CS["CalibrationScene (Demo Scene)"]:::demo
        TS["Test Scene (Demo)"]:::demo
    end

    %% Editor Tools & Packaging (Second Layer)
    subgraph "Editor Tools & Packaging"
        PT["PackageTool (Editor Extension)"]:::editor
        AEE["AnalogGlitchEditor (Editor)"]:::editor
        DEE["DigitalGlitchEditor (Editor)"]:::editor
    end

    %% Utility & Additional Effects (Third Layer)
    subgraph "Utility & Additional Effects"
        CM["ConstantMotion (Utility)"]:::utility
        JM["JitterMotion (Utility)"]:::utility
        CEM["ConstantMotionEditor (Editor)"]:::utility
        JEM["JitterMotionEditor (Editor)"]:::utility
    end

    %% Core Glitch Effects Module – Analog & Digital (Fourth/Middle Layer)
    subgraph "Core Glitch Effects Module – Analog & Digital"
        A1["Analog Glitch Script (C#)"]:::core
        A2["Digital Glitch Script (C#)"]:::core
        AS["Analog Glitch Shader (Unity Shader)"]:::core
        DS["Digital Glitch Shader (Unity Shader)"]:::core
    end

    %% Unity Engine & Configuration (Bottom Layer)
    subgraph "Unity Engine & Configuration"
        UE["Unity Engine/ProjectSettings<br/>(Unity Config)"]:::engine
    end

    %% Connections

    %% Editor Tools -> Core Effects
    PT -->|"configures"| A1
    PT -->|"configures"| A2
    AEE -->|"edits"| A1
    DEE -->|"edits"| A2

    %% Demo Scenes -> Core Effects
    CS -->|"demonstrates"| A1
    CS -->|"demonstrates"| A2
    TS -->|"demonstrates"| A1
    TS -->|"demonstrates"| A2

    %% Demo Scenes -> Utilities
    CS -->|"uses"| CM
    CS -->|"uses"| JM
    TS -->|"uses"| CM
    TS -->|"uses"| JM

    %% Unity Engine supports Modules and Utilities
    UE -->|"supports"| A1
    UE -->|"supports"| A2
    UE -->|"supports"| CM
    UE -->|"supports"| JM

    %% Styling
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef editor fill:#FFA500,stroke:#333,stroke-width:2px;
    classDef utility fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef demo fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef engine fill:#DDA0DD,stroke:#333,stroke-width:2px;

    %% Click Events
    click A1 "https://github.com/keijiro/kinoglitch/blob/master/Assets/Kino/Glitch/AnalogGlitch.cs"
    click A2 "https://github.com/keijiro/kinoglitch/blob/master/Assets/Kino/Glitch/DigitalGlitch.cs"
    click AS "https://github.com/keijiro/kinoglitch/blob/master/Assets/Kino/Glitch/Shader/AnalogGlitch.shader"
    click DS "https://github.com/keijiro/kinoglitch/blob/master/Assets/Kino/Glitch/Shader/DigitalGlitch.shader"
    click PT "https://github.com/keijiro/kinoglitch/blob/master/Assets/Editor/PackageTool.cs"
    click AEE "https://github.com/keijiro/kinoglitch/blob/master/Assets/Kino/Glitch/Editor/AnalogGlitchEditor.cs"
    click DEE "https://github.com/keijiro/kinoglitch/blob/master/Assets/Kino/Glitch/Editor/DigitalGlitchEditor.cs"
    click CM "https://github.com/keijiro/kinoglitch/blob/master/Assets/Reaktion/Utility/ConstantMotion.cs"
    click JM "https://github.com/keijiro/kinoglitch/blob/master/Assets/Reaktion/Utility/JitterMotion.cs"
    click CEM "https://github.com/keijiro/kinoglitch/blob/master/Assets/Reaktion/Editor/Utility/ConstantMotionEditor.cs"
    click JEM "https://github.com/keijiro/kinoglitch/blob/master/Assets/Reaktion/Editor/Utility/JitterMotionEditor.cs"
    click CS "https://github.com/keijiro/kinoglitch/tree/master/Assets/CalibrationScene"
    click TS "https://github.com/keijiro/kinoglitch/tree/master/Assets/Test"
    click UE "https://github.com/keijiro/kinoglitch/tree/master/ProjectSettings"
```
