Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void generateLyric(String text, String pixel, double startTime, double endTime, Color4 color, Vector2 pos)
- {
- bool top = true;
- double scale = 0.2;
- double posX = 0;
- double fadeOpac = 0.8;
- double lineWidth = GetLineWidth(scale, text, thin);
- double timeIncrement = startTime + 0.1;
- var box = GetLayer("Lyrics").CreateSprite(pixel);
- box.ScaleVec(OsbEasing.OutExpo, startTime, endTime, new Vector2(0, 3), new Vector2((float)lineWidth + 50, 1));
- box.Color(startTime, color);
- box.Move(startTime, new Vector2(320, 265));
- box.Fade(startTime, endTime, 0, 0.4);
- foreach (var letter in text)
- {
- var texture = thin.GetTexture(letter.ToString());
- if (!texture.IsEmpty)
- {
- Vector2 position = new Vector2((float)(pos.X - 0.5f * lineWidth) + (float)(posX + texture.OffsetFor(OsbOrigin.Centre).X * scale), 0);
- var sprite = GetLayer("Lyrics").CreateSprite(texture.Path, OsbOrigin.Centre, new Vector2(position.X, pos.Y));
- if (top)
- {
- sprite.Fade(startTime, 0);
- sprite.Scale(timeIncrement, scale);
- sprite.Color(timeIncrement, color);
- sprite.MoveY(OsbEasing.None, timeIncrement, endTime, pos.Y - 3, pos.Y);
- timeIncrement += 5;
- }
- else
- {
- sprite.Fade(startTime, 0);
- sprite.Scale(timeIncrement, scale);
- sprite.Color(timeIncrement, color);
- sprite.MoveY(OsbEasing.None, timeIncrement, endTime, pos.Y + 3, pos.Y);
- timeIncrement += 5;
- }
- sprite.Fade(startTime, endTime, 0, fadeOpac);
- }
- posX += texture.BaseWidth * scale;
- top = !top;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement