Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ivan-1f/phichain/llms.txt
Use this file to discover all available pages before exploring further.
phichain-chart
Thephichain-chart crate is the core library for representing and manipulating Phigros charts in the Phichain toolchain. It provides data structures for beats, notes, lines, events, and complete chart serialization.
Installation
Add this to yourCargo.toml:
Dependencies
The crate depends on:bevy0.16.1 (optional, for game engine integration)serde1.0 (for serialization)num0.4.3 (for rational number support)simple-easing1.0.1 (for easing functions)anyhow1.0 (for error handling)
Core Modules
beat
Represents musical beats using rational numbers for precise timing.A beat in the chart, represented with a whole part and a rational part.
Beat Methods
Beat Methods
new(whole: i32, ratio: Rational32) -> Beat- Create a new beatvalue() -> f32- Get the float value of the beatbeat() -> i32- Get the whole partnumer() -> i32- Get the numerator of the fractional partdenom() -> i32- Get the denominator of the fractional partreduce() -> &mut Self- Reduce the beat to canonical formreduced() -> Self- Get a reduced copy of the beatabs() -> Self- Get the absolute value
bpm_list
Manages tempo changes throughout the chart.A list of BPM (beats per minute) change points.
note
Defines note types and properties.The type of note.
A note in the chart.
line
Represents judgment lines in the chart.A judgment line that contains notes.
bevy feature is enabled, additional components are available:
LinePosition(Vec2)- Position of the lineLineRotation(f32)- Rotation angle in degreesLineOpacity(f32)- Opacity (0.0 to 1.0)LineSpeed(f32)- Current speed multiplier
event
Defines line animation events.The type of line event.
The value of a line event, either constant or transitioning.
A timed event that affects a line’s properties.
easing
Provides easing functions for smooth animations.Easing functions for interpolation. See easings.net for visual examples.
serialization
Provides chart serialization and deserialization.The main chart structure.
A line with its notes, events, and children for serialization.
project
Manages chart project directories.Represents a Phichain project directory.
Project metadata from
meta.json.Complete Example
Bevy Integration
When using thebevy feature, chart components integrate with Bevy’s ECS:
Format Migration
The library includes migration support for older chart formats:See Also
- phichain-compiler - Compile charts for gameplay
- phichain-game - Game engine for playing charts
- Official Chart Format - Phigros chart format reference