Script: Slider Array - Poyo-SSB/osu-playground GitHub Wiki

function start() {
	var center = Playground.AddVector2('center', new Vector2(Playground.PLAYFIELD_WIDTH / 2, Playground.PLAYFIELD_HEIGHT / 2));
	var point1 = Playground.AddVector2('point1', new Vector2(Playground.PLAYFIELD_WIDTH / 2 + 50, Playground.PLAYFIELD_HEIGHT / 2));
	var point2 = Playground.AddVector2('point2', new Vector2(Playground.PLAYFIELD_WIDTH / 2 + 100, Playground.PLAYFIELD_HEIGHT / 2));
	var point3 = Playground.AddVector2('point3', new Vector2(Playground.PLAYFIELD_WIDTH / 2 + 150, Playground.PLAYFIELD_HEIGHT / 2));
	var ngon = Playground.AddInt('ngon', 10);

	Playground.AddOptionVector2(center, 'Center');
	Playground.AddOptionVector2(point1, 'Point 1');
	Playground.AddOptionVector2(point2, 'Point 2');
	Playground.AddOptionVector2(point3, 'Point 3');
	Playground.AddOptionInt(ngon, 'N-gon', 3, 16);
}

function update() {
	var center = Playground.GetValueVector2('center');
	var point1 = Playground.GetValueVector2('point1');
	var point2 = Playground.GetValueVector2('point2');
	var point3 = Playground.GetValueVector2('point3');
	var ngon = Playground.GetValueInt('ngon');

	for (var i = 0; i < ngon + 1; i++) {
		Playground.AddSlider(CurveType.PerfectCurve, [
			rotate(point1, center, i * 2 * Math.PI / ngon),
			rotate(point2, center, i * 2 * Math.PI / ngon),
			rotate(point3, center, i * 2 * Math.PI / ngon)
		]);
	}
}