Utilities
Slide Utilities
What is this?
Here are a few useful utilities you may want to use.
If the generated note extends outside the lane range, call .clamp() to constrain all nodes to
valid lanes.
Crease
crease(...) creates a zigzag around a base curve. The first and last
waypoints stay unchanged, while the interior waypoints alternate between 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)
Envelope
envelope(...) weaves back and forth between two curves.
Both curves must have the same start time 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=0).to(t=(1, 0), x=14, ease_x="in_sine")
outer = Curve(t=(0, 0), x=2).to(t=(1, 0), x=14, ease_x="out_sine")
slide = envelope(inner, outer, count=64).to_slide(w=2)
Rain
rain(...) generates a group of AirCrush notes scattered like raindrops
across a time range.
from margrete_rpc.chart.util import rain
drops = rain(
t0=(0, 0),
t1=(1, 0),
step=(1, 64),
length=(1, 32),
x_range=(0, 15),
h_range=(0, 140),
w=2,
color="sky",
)
for n in drops:
n.clamp()
tx.chart.notes.extend(drops)
x_range and h_range are inclusive. Drops that would extend past t1 are truncated to end at t1.