Advanced
Slide Utilities
Generate common slide-like patterns.
Crease
crease(...) creates a zigzag around a base curve. The first and last
points stay on the base; interior points alternate positive and negative offsets.
from margrete_rpc.chart.util import Curve, crease
base = Curve(t=(0, 0), x=2, h=70).to(t=(1, 0), x=12, h=120, ease_x="out_quad")
slide = crease(base, count=6, x_range=2).to_slide(w=4).clamp()
air = crease(base, count=6, x_range=0, h_range=20).to_air_slide(w=4)Use .clamp() after materializing if the offsets may push the note outside the lane field.
Envelope
envelope(...) weaves between two boundary curves. Both curves must
share the same start and end time. An even count ends back on inner; an odd count ends on outer.
from margrete_rpc.chart.util import Curve, envelope
inner = Curve(t=(0, 0), x=2).to(t=(1, 0), x=6, ease_x="in_sine")
outer = Curve(t=(0, 0), x=10).to(t=(1, 0), x=14, ease_x="out_sine")
slide = envelope(inner, outer, count=4).to_slide(w=2)Rain
rain(...) generates a list of short AirCrush notes across a time range.
Use seed= when you want the same scatter every time the script runs.
from margrete_rpc.chart.util import rain
drops = rain(
t0=(0, 0),
t1=(4, 0),
step=(1, 16),
length=(1, 16),
x_range=(0, 15),
h_range=(60, 140),
w=1,
color="sky",
seed=42,
)
tx.chart.notes.extend(drops)x_range and h_range are inclusive. Drops that would extend past t1 are truncated to end at t1.