forked from nikita/muzika-gromche
New operators for Palette
With these it would be easier to create more complicated timelines without repeating yourself over and over again.
This commit is contained in:
parent
43d1565dbe
commit
2df7d28d43
|
@ -263,6 +263,28 @@ namespace MuzikaGromche
|
||||||
}
|
}
|
||||||
return new Palette(colors);
|
return new Palette(colors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Palette operator +(Palette before, Palette after)
|
||||||
|
{
|
||||||
|
return new Palette([.. before.Colors, .. after.Colors]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Palette operator *(Palette palette, int repeat)
|
||||||
|
{
|
||||||
|
var colors = Enumerable.Repeat(palette.Colors, repeat).SelectMany(x => x).ToArray();
|
||||||
|
return new Palette(colors);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Palette Stretch(int times)
|
||||||
|
{
|
||||||
|
var colors = Colors.SelectMany(color => Enumerable.Repeat(color, times)).ToArray();
|
||||||
|
return new Palette(colors);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Palette Use(Func<Palette, Palette> op)
|
||||||
|
{
|
||||||
|
return op.Invoke(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Track
|
public class Track
|
||||||
|
|
Loading…
Reference in New Issue