void _Box(Vector2 scale, Vector2 pos, Color color, float rotation, float level) { var lp = new LineParams2 { position = pos, color = color, scale = scale, rotation = rotation, level = level }; var mp = new MotionParams(); NoteFactory.CreateLine(lp, mp); }
void _FixedLine(float width, float xOffset, Color color, float level) { var scale = new Vector2(width, CameraHelper.Height * 2); var lp = new LineParams2 { position = new Vector2(CameraHelper.Width * xOffset - CameraHelper.HalfWidth, 0), color = color, scale = scale, rotation = 0, level = level }; var mp = new MotionParams(); NoteFactory.CreateLine(lp, mp); }
void AnimateRect(Direction dir, float speed, Vector2 scale, Color color, Vector2 position, float rotation = 0, float level = 0) { var lp = new LineParams2 { position = position, color = color, scale = scale, rotation = rotation, level = level }; var mp = new MotionParams { velocity = dir.ToVelocity(speed) }; NoteFactory.CreateLine(lp, mp); }
void AnimateRect(Direction dir, float speed, Vector2 scale, Color color, float offset = 0, float rotation = 0, float level = 0) { var lp = new LineParams2 { position = CameraHelper.PerimeterPositionForMovingObject(dir, offset, scale, rotation), color = color, scale = scale, rotation = rotation, level = level }; var mp = new MotionParams { velocity = dir.ToVelocity(speed) }; NoteFactory.CreateLine(lp, mp); }
void _Box(Vector2 scale, Vector2 pos, Color color, float rotation, float level) { var lp = new LineParams2 { position = pos, color = color, scale = scale, rotation = rotation, level = level }; var mp = new MotionParams(); var anim = NoteFactory.CreateLine(lp, mp); anim.DestroyIn(BeatDurationInSeconds * destroyInMeasures * 4); }
void _Line(Direction dir, float height, float offset, float deltaSpeed = 0) { var scale = dir.Align(new Vector2(defaultLineWidth, height * (Random.value * 0.7f + 0.65f))); var lp = new LineParams2 { position = CameraHelper.PerimeterPositionForMovingObject(dir, offset, scale, 0), color = lineColor, scale = scale, rotation = 0, level = ShapeZLevel.Front }; var mp = new MotionParams { velocity = dir.ToVelocity(defaultLineSpeed + deltaSpeed) }; NoteFactory.CreateLine(lp, mp); }
void _Line2(Direction dir, float width, float height, float offset, float speed, Color color, float level) { var scale = new Vector2(width, height); var lp = new LineParams2 { position = CameraHelper.PerimeterPositionForMovingObject(dir, 0, scale, 0), color = color, scale = scale, rotation = 0, level = level }; var mp = new MotionParams { velocity = dir.ToVelocity(speed) }; NoteFactory.CreateLine(lp, mp); }
void _FixedLine(float width, float xOffset, Color color, float level) { var scale = new Vector2(width, CameraHelper.Height * 2); var lp = new LineParams2 { position = new Vector2(CameraHelper.Width * xOffset - CameraHelper.HalfWidth, 0), color = color, scale = scale, rotation = 0, level = level }; var mp = new MotionParams(); var anim = NoteFactory.CreateLine(lp, mp); anim.DestroyIn(BeatDurationInSeconds * destroyInMeasures * 4); }
void _Line(Direction dir, float width, float speed, Color color, float level) { var scale = new Vector2(width, CameraHelper.Height * 2); var lp = new LineParams2 { position = CameraHelper.PerimeterPositionForMovingObject(dir, 0, scale, 0), color = color, scale = scale, rotation = 0, level = level }; var mp = new MotionParams { velocity = dir.ToVelocity(speed) }; var anim = NoteFactory.CreateLine(lp, mp); anim.DestroyIn(BeatDurationInSeconds * destroyInMeasures * 4); }
void CreateLineGraph() { int numberOfLines = 10; float baseLength = 2; float lengthIncrement = 0.5f; int lengthInflectionCount = 5; float baseSpeed = 0.5f; float speedIncrement = 0.04f; int speedInflectionCount = 2; float baseWidth = 0.05f; float baseGap = 0.1f; var equalizerWidth = numberOfLines * baseWidth + (numberOfLines - 1) * baseGap; var lengthInflections = RandomHelper.Points(0, numberOfLines, lengthInflectionCount); lengthInflections.Add(int.MaxValue); var nextLenInflection = lengthInflections[0]; lengthInflections.RemoveAt(0); var speedInflections = RandomHelper.Points(0, numberOfLines, speedInflectionCount); speedInflections.Add(int.MaxValue); var nextSpeedInflection = speedInflections[0]; speedInflections.RemoveAt(0); var currXPos = (CameraHelper.Width - equalizerWidth) * Random.value - CameraHelper.HalfWidth; var currLenDir = 1; var currLen = baseLength; var currSpeedDir = 1; var currSpeed = baseSpeed; for (int i = 0; i < numberOfLines; i++) { var line = new LineParams2(); line.length = currLen; line.width = baseWidth; line.x = currXPos; line.y = (CameraHelper.Height + baseLength * 2) / -2f - 2f; line.color = lineColor; NoteFactory.CreateLine(line, new MotionParams { velocity = Vector2.up * currSpeed }); // next currXPos += baseWidth + baseGap; currLen += currLenDir * lengthIncrement; currSpeed += speedIncrement * currSpeedDir; if (nextLenInflection <= i) { // reverse dir currLenDir *= -1; nextLenInflection = lengthInflections[0]; lengthInflections.RemoveAt(0); } if (nextSpeedInflection <= i) { // reverse dir currSpeedDir *= -1; nextSpeedInflection = speedInflections[0]; speedInflections.RemoveAt(0); } } }
public static Animatable2 CreateLine(LineParams2 lp, MotionParams mp = new MotionParams()) { return(CreateRect(lp.ToRectParams(), mp)); }