Exemple #1
0
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(320 - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;

                var sprite = layer.CreateSprite(texture.Path, Origin, position);
                var bar    = layer.CreateSprite(BarPath, Origin, position);
                bar.Rotate(line.StartTime - 200, 1.5708);
                bar.MoveY(line.StartTime - 200, 450);
                bar.ScaleVec(OsbEasing.Out, line.StartTime - 200, line.StartTime + 100, 0, 0, 0.05, 1);
                bar.ScaleVec(line.StartTime + 100, line.EndTime, 0.05, 1, 0.05, 2);

                sprite.Scale(OsbEasing.Out, line.StartTime - 200, line.StartTime + 100, 0, 0.5);
                sprite.Scale(line.StartTime + 100, line.EndTime, 0.5, 0.55);
                sprite.Fade(line.StartTime - 200, line.StartTime, 0, 1);
                sprite.Fade(line.EndTime - 200, line.EndTime, 1, 0);
                bar.Fade(line.StartTime - 200, line.StartTime, 0, 1);
                bar.Fade(line.EndTime - 200, line.EndTime, 1, 0);
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
            }
        }
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            double last_first_time = 22993;
            double last_end_time   = 23346;

            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(SubtitleX - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;
                var lastPosition = new Vector2(SubtitleX - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                                   + texture.OffsetFor(Origin) * FontScale + new Vector2(-10, 30);
                var firstPosition = new Vector2(SubtitleX - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                                    + texture.OffsetFor(Origin) * FontScale + new Vector2(10, -30);

                var sprite = layer.CreateSprite(texture.Path, Origin, position);
                sprite.Rotate(line.StartTime - 200, MathHelper.DegreesToRadians(9));
                sprite.Scale(line.StartTime, FontScale);

                sprite.Color((OsbEasing)6, line.StartTime - 200, line.EndTime, Color4.Red, Color4.White);

                sprite.Fade(last_first_time - 300, last_first_time, 0, 0.4);
                sprite.Fade(last_end_time - 200, last_end_time, 0.4, 1);
                sprite.Move((OsbEasing)3, last_end_time - 200, last_end_time, firstPosition, position);
                sprite.Fade(line.EndTime - 200, line.EndTime, 1, 0);
                sprite.Move((OsbEasing)3, line.EndTime - 200, line.EndTime, position, lastPosition);
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
                last_first_time = line.StartTime;
                last_end_time   = line.EndTime;
            }
        }
Exemple #3
0
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(320 - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;

                var sprite = layer.CreateSprite(texture.Path, Origin, position);
                sprite.Scale(line.StartTime, FontScale);
                sprite.Fade(line.StartTime - 200, line.StartTime, 0, 1);

                if (line.StartTime < 127564)
                {
                    sprite.Rotate(line.StartTime - 200, 0.1);
                    sprite.Move(OsbEasing.Out, line.StartTime, line.StartTime + 200, -500, 10, 320, 90);
                    sprite.Move(line.StartTime + 200, line.EndTime, 320, 90, 360, 95);
                    sprite.Fade(line.EndTime - 200, line.EndTime, 1, 0);
                }
                if (line.StartTime > 127564)
                {
                    sprite.Rotate(line.StartTime - 200, -0.1);
                    sprite.Move(OsbEasing.Out, line.StartTime, line.StartTime + 200, -500, 430, 320, 350);
                    sprite.Move(line.StartTime + 200, line.EndTime, 320, 350, 360, 345);
                    sprite.Fade(line.EndTime - 600, line.EndTime - 300, 1, 0);
                }
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
            }
        }
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(80 - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;

                var sprite = layer.CreateSprite(texture.Path, Origin, position);
                sprite.Scale(line.StartTime, FontScale);
                sprite.Fade(line.StartTime - 200, line.StartTime, 0, 1);
                sprite.Fade(line.EndTime - 400, line.EndTime, 1, 0);
                if (direction)
                {
                    sprite.MoveY(OsbEasing.OutExpo, line.StartTime, line.EndTime, -40, 185);
                }
                else
                {
                    sprite.MoveY(OsbEasing.OutExpo, line.StartTime, line.EndTime, 460, 235);
                }
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
            }
        }
Exemple #5
0
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(320 - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;

                var sprite = layer.CreateSprite(texture.Path, Origin, position);
                sprite.Scale(line.StartTime, FontScale);
                sprite.Fade(line.StartTime - 200, line.StartTime, 0, 1);
                sprite.Fade(line.EndTime - 750, line.EndTime - 250, 1, 0);
                int pos      = -25;
                int posAfter = -25;
                sprite.MoveX(OsbEasing.Out, line.StartTime - 500, line.StartTime, pos - 100, pos);
                for (double i = line.StartTime; i <= line.EndTime; i += 75)
                {
                    posAfter += 1;
                    sprite.MoveX(i, i + 75, pos, posAfter);
                    pos = posAfter;
                }
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
            }
        }
Exemple #6
0
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var line in subtitles.Lines)
            {
                Vector2[] shakePosition;
                shakePosition = new Vector2[10];

                for (int i = 0; i < 10; i++)
                {
                    shakePosition[i] = new Vector2(
                        (float)Random(0, 2),
                        (float)Random(0, 2)
                        );
                }
                var beat      = 509;
                int loopCount = (int)Math.Ceiling((line.EndTime - line.StartTime - 200) / (10 * beat / 4));
                var value     = line.Text;

                var lineY = SubtitleY;
                if (line.StartTime > 209149)
                {
                    lineY = 150;
                }

                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(320 - texture.BaseWidth * FontScale * 0.5f, lineY)
                               + texture.OffsetFor(Origin) * FontScale;

                var sprite = layer.CreateSprite(texture.Path, Origin, position);

                sprite.ScaleVec(line.StartTime, FontScale, FontScale);
                sprite.Fade(line.StartTime - 200, line.StartTime, 0, 1);
                sprite.Fade(line.EndTime - 200, line.EndTime, 1, 0);

                sprite.StartLoopGroup(line.StartTime - 200, loopCount);
                for (int i = 0; i < 10; i++)
                {
                    sprite.Move(OsbEasing.OutBounce, beat / 4 * i, beat / 4 * (i + 1), position + shakePosition[i], position - shakePosition[i] / 2);
                }
                sprite.EndGroup();

                sprite.ScaleVec(line.EndTime - 200, line.EndTime, FontScale, FontScale, FontScale + 0.5, 0);


                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }

                if (value == "Killing")
                {
                    sprite.Color(line.StartTime - 200, 0.8, 0, 0);
                }
            }
        }
Exemple #7
0
        public void generateLyrics(FontGenerator font, SubtitleSet subtitles, string layerName, bool additive)
        {
            var layer = GetLayer(layerName);

            if (PerCharacter)
            {
                generatePerCharacter(font, subtitles, layer, additive);
            }
            else
            {
                generatePerLine(font, subtitles, layer, additive);
            }
        }
        public void generatePerCharacter(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var subtitleLine in subtitles.Lines)
            {
                var letterY = SubtitleY;
                foreach (var line in subtitleLine.Text.Split('\n'))
                {
                    var lineWidth  = 0f;
                    var lineHeight = 0f;
                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        lineWidth += texture.BaseWidth * FontScale;
                        lineHeight = Math.Max(lineHeight, texture.BaseHeight * FontScale);
                    }

                    var letterX = 320 - lineWidth * 0.5f;
                    var run     = 0;
                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        if (!texture.IsEmpty)
                        {
                            var position = new Vector2(letterX, letterY)
                                           + texture.OffsetFor(Origin) * FontScale;
                            var lastPosition = new Vector2(letterX, letterY)
                                               + texture.OffsetFor(Origin) * FontScale + new Vector2(0, -20);
                            var firstPosition = new Vector2(letterX, letterY)
                                                + texture.OffsetFor(Origin) * FontScale + new Vector2(0, +15);

                            var sprite = layer.CreateSprite(texture.Path, Origin, position);
                            sprite.Scale(subtitleLine.StartTime, FontScale);
                            sprite.Move(subtitleLine.StartTime - 200, subtitleLine.StartTime - 200 + run, firstPosition, position);
                            sprite.Fade(subtitleLine.StartTime - 200, subtitleLine.StartTime - 200 + run, 0, 1);
                            sprite.Fade(subtitleLine.EndTime - 200, subtitleLine.EndTime, 1, 0);
                            sprite.Move(subtitleLine.EndTime - 200, subtitleLine.EndTime, position, lastPosition);
                            sprite.ScaleVec((OsbEasing)6, subtitleLine.EndTime - 200, subtitleLine.EndTime, FontScale, FontScale, FontScale, 0);
                            if (additive)
                            {
                                sprite.Additive(subtitleLine.StartTime - 200, subtitleLine.EndTime);
                            }
                        }
                        letterX += texture.BaseWidth * FontScale;
                        run     += 14;
                    }
                    letterY += lineHeight;
                }
            }
        }
        private void generateLyrics(FontGenerator font, SubtitleSet subtitles)
        {
            foreach (var subtitleLine in subtitles.Lines)
            {
                var letterY = 240f;
                foreach (var line in subtitleLine.Text.Split('\n'))
                {
                    var lineWidth  = 0f;
                    var lineHeight = 0f;
                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        lineWidth += texture.BaseWidth * fontscale;
                        lineHeight = Math.Max(lineHeight, texture.BaseHeight * fontscale);
                    }

                    var     letterX = 320 - lineWidth * 0.5f;
                    Vector2 center  = new Vector2(320, 240);
                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        if (!texture.IsEmpty)
                        {
                            var position = new Vector2(letterX, (float)(letterY - lineHeight * 0.5)) // Moving Lyics To Y center
                                           + texture.OffsetFor(OsbOrigin.Centre) * fontscale;

                            var distance = Vector2.Subtract(position, center); // Distance between each letter and center

                            var sprite = GetLayer("").CreateSprite(texture.Path, OsbOrigin.Centre);
                            // Move away from center
                            sprite.MoveY(subtitleLine.StartTime, position.Y);
                            sprite.MoveX(subtitleLine.StartTime, subtitleLine.EndTime, position.X, position.X + distance.X * 0.25);
                            sprite.Scale(subtitleLine.StartTime, fontscale);
                            sprite.Fade(subtitleLine.StartTime, subtitleLine.StartTime + Constants.beatLength * 0.25, 0, 1);
                            // Move back to center
                            distance = Vector2.Subtract(sprite.PositionAt(subtitleLine.EndTime), center);
                            sprite.MoveX(subtitleLine.EndTime, subtitleLine.EndTime + Constants.beatLength * 0.25, sprite.PositionAt(subtitleLine.EndTime).X, Vector2.Subtract(sprite.PositionAt(subtitleLine.EndTime), distance).X);
                            sprite.Fade(subtitleLine.EndTime, subtitleLine.EndTime + Constants.beatLength * 0.25, 1, 0);
                            sprite.Scale(subtitleLine.EndTime, subtitleLine.EndTime + Constants.beatLength * 0.25, fontscale, 0);
                        }
                        letterX += texture.BaseWidth * fontscale;
                    }
                    letterY += lineHeight;
                }
            }
        }
Exemple #10
0
        public void generateLyrics(FontGenerator font, SubtitleSet subtitles, string layerName)
        {
            var layer = GetLayer(layerName);

            foreach (var subtitleLine in subtitles.Lines)
            {
                float letterY    = SubtitleY;
                float whiteSpace = 3f;
                foreach (var line in subtitleLine.Text.Split('\n'))
                {
                    var lineWidth  = 0f;
                    var lineHeight = 0f;
                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        lineWidth += texture.BaseWidth * mainFontScale + whiteSpace;
                        lineHeight = Math.Max(lineHeight, texture.BaseHeight * mainFontScale);
                    }
                    var    letterX      = 320 - lineWidth * 0.5f;
                    double relativeTime = subtitleLine.StartTime;
                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        if (!texture.IsEmpty)
                        {
                            var position = new Vector2(letterX, letterY)
                                           + texture.OffsetFor(OsbOrigin.Centre) * mainFontScale;
                            Vector2 offscreen   = Vector2.Subtract(new Vector2(-200, position.Y), position);
                            Vector2 screenright = new Vector2(600, position.Y);


                            var sprite = layer.CreateSprite(texture.Path, OsbOrigin.Centre, position);
                            sprite.Scale(relativeTime, mainFontScale);
                            sprite.Fade(relativeTime - 227, relativeTime, 0, 1);
                            sprite.Move(subtitleLine.EndTime - 227, subtitleLine.EndTime, position, Vector2.Add(position, new Vector2(Random(-5, 5), Random(-20, 20))));
                            sprite.Scale(subtitleLine.EndTime - 227, subtitleLine.EndTime, mainFontScale, 0);
                            sprite.Fade(subtitleLine.EndTime - 227, subtitleLine.EndTime, 1, 0);
                        }
                        letterX      += texture.BaseWidth * mainFontScale + whiteSpace;
                        relativeTime += 114 / 2;
                    }
                    letterY += lineHeight;
                }
            }
        }
Exemple #11
0
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(320 - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;

                var sprite = layer.CreateSprite(texture.Path, Origin, position);
                sprite.Scale(line.StartTime, line.EndTime, FontScale, FontScale - 0.05);
                sprite.Fade(line.StartTime - 200, line.StartTime + 200, 0, 1);
                sprite.Fade(line.EndTime - 200, line.EndTime, 1, 0);
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
            }
        }
Exemple #12
0
        public void generateSukiLyrics(FontGenerator font, SubtitleSet subtitles, string layerName)
        {
            var layer = GetLayer(layerName);

            foreach (var subtitleLine in subtitles.Lines)
            {
                var   letterY    = 240f;
                float whiteSpace = 6f;
                foreach (var line in subtitleLine.Text.Split('\n'))
                {
                    var lineWidth  = 0f;
                    var lineHeight = 0f;
                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        lineWidth += (texture.BaseWidth + whiteSpace) * sideFontScale;
                        lineHeight = Math.Max(lineHeight, texture.BaseHeight * sideFontScale);
                    }
                    var     letterX = 320 - lineWidth * 0.5f;
                    Vector2 center  = new Vector2(320, 240);
                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        if (!texture.IsEmpty)
                        {
                            var position = new Vector2(letterX, (float)(letterY - lineHeight * 0.5))
                                           + texture.OffsetFor(OsbOrigin.Centre) * sideFontScale;

                            var distance = Vector2.Subtract(position, center) * 0.3f;

                            var sprite = layer.CreateSprite(texture.Path, OsbOrigin.Centre);
                            sprite.MoveX(subtitleLine.StartTime - 227, subtitleLine.StartTime, 320, position.X);
                            sprite.MoveX(subtitleLine.StartTime, subtitleLine.EndTime, sprite.PositionAt(subtitleLine.StartTime).X, Vector2.Add(sprite.PositionAt(subtitleLine.StartTime), distance).X);
                            sprite.Scale(subtitleLine.StartTime, sideFontScale);
                            sprite.Fade(subtitleLine.StartTime - 227, subtitleLine.StartTime, 0, 1);
                            sprite.Fade(subtitleLine.EndTime - 227, subtitleLine.EndTime, 1, 0);
                            sprite.Additive(subtitleLine.StartTime - 227, subtitleLine.EndTime);
                        }
                        letterX += (texture.BaseWidth + whiteSpace) * sideFontScale;
                    }
                    letterY += lineHeight;
                }
            }
        }
Exemple #13
0
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(320 - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;

                var sprite = layer.CreateSprite(texture.Path, Origin, position);
                sprite.Rotate(line.StartTime, 0.4);
                sprite.Scale(line.StartTime, FontScale);
                sprite.Fade(line.StartTime - 200, line.StartTime, 0, 1);
                sprite.Fade(line.EndTime - 200, line.EndTime, 1, 0);
                double posx      = -25;
                double posxAfter = -25;
                double posy      = 220;
                double posyAfter = 220;
                sprite.MoveX(OsbEasing.Out, line.StartTime - 500, line.StartTime, posx - 500, posx);
                sprite.MoveY(OsbEasing.Out, line.StartTime - 500, line.StartTime, posy - 200, posy);

                for (double i = line.StartTime; i <= line.EndTime; i += 75)
                {
                    posxAfter += 1;
                    posyAfter += 0.5;
                    sprite.MoveX(i, i + 75, posx, posxAfter);
                    sprite.MoveY(i, i + 75, posy, posyAfter);
                    posx = posxAfter;
                    posy = posyAfter;
                }
                sprite.MoveX(OsbEasing.InCubic, line.EndTime - 500, line.EndTime + 250, posxAfter - 6, posx + 475);
                sprite.MoveY(OsbEasing.InCubic, line.EndTime - 500, line.EndTime + 250, posyAfter - 3, posy + 200);
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
            }
        }
Exemple #14
0
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(320 - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;

                var sprite  = layer.CreateSprite(texture.Path, Origin, position);
                var glitch1 = layer.CreateSprite(texture.Path, Origin, position);
                var glitch2 = layer.CreateSprite(texture.Path, Origin, position);
                sprite.Scale(OsbEasing.Out, line.StartTime, line.StartTime + 300, 0, FontScale * 0.9);
                sprite.Scale(OsbEasing.In, line.StartTime + 300, line.EndTime, FontScale * 0.9, FontScale);
                glitch1.Color(line.StartTime + 900, 0.8, 0.06, 0.223);
                glitch2.Color(line.StartTime + 900, 0.058, 0.98, 0.98);

                glitch1.Fade(line.StartTime + 300, line.StartTime + 400, 0, 0);
                glitch1.Fade(line.StartTime + 400, line.StartTime + 500, 0.25, 0.25);
                glitch1.Fade(line.StartTime + 500, line.EndTime, 0, 0);
                glitch1.Scale(OsbEasing.Out, line.StartTime, line.StartTime + 300, 0, FontScale * 0.9);
                glitch1.Scale(OsbEasing.In, line.StartTime + 300, line.EndTime, FontScale * 0.9, FontScale);
                glitch1.Move(line.StartTime + 300, 317, 218);

                glitch2.Fade(line.StartTime + 350, line.StartTime + 450, 0, 0);
                glitch2.Fade(line.StartTime + 450, line.StartTime + 550, 0.25, 0.25);
                glitch2.Fade(line.StartTime + 550, line.EndTime, 0, 0);
                glitch2.Scale(OsbEasing.Out, line.StartTime, line.StartTime + 350, 0, FontScale * 0.9);
                glitch2.Scale(OsbEasing.In, line.StartTime + 350, line.EndTime, FontScale * 0.9, FontScale);
                glitch2.Move(line.StartTime + 350, 323, 218);

                sprite.Fade(line.StartTime, line.EndTime, 1, 0);
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
            }
        }
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            var positionList = new TupleList <int, int> {
                { 120, 100 }, //I'll
                { 230, 100 }, //find
                { 370, 100 }, //some
                { 120, 138 }, //peace
                { 120, 192 }, //this
                { 120, 254 }, //time
                { 306, 194 }, //i'll
                { 410, 194 }, //let
                { 306, 254 }, //you
                { 120, 312 }, //Know
                { 155, 160 }, //we're
                { 325, 160 }, //gonna
                { 155, 206 }, //grow
                { 110, 100 }, //i'm
                { 180, 100 }, //gonna
                { 250, 146 }, //show
                { 316, 190 }, //you
                { 110, 146 }, //my
                { 110, 240 }, //Heart
                { 340, 240 }, //and
                { 110, 300 }, //soul
                { 200, 150 }, // this
                { 325, 150 }, //time
                { 138, 190 }, //this
                { 325, 190 }, //time
                { 170, 140 }, //my
                { 150, 180 }, //love
                { 3, 1 },
                { 1, 1 }
            };
            var scaleList = new TupleList <double, double> {
                { 0.35, 0.35 },  //I'll
                { 0.35, 0.35 },  //find
                { 0.35, 0.35 },  //some
                { 0.845, 0.50 }, //peace
                { 0.55, 0.55 },  //this
                { 0.55, 0.55 },  //time
                { 0.45, 0.45 },  //i'll
                { 0.42, 0.45 },  //let
                { 0.65, 0.53 },  //you
                { 0.900, 0.60 }, //Know
                { 0.35, 0.35 },  //we're
                { 0.35, 0.35 },  //gonna
                { 0.78, 1.3 },   //grow
                { 0.35, 0.35 },  //i'm
                { 0.35, 0.35 },  //gonna
                { 0.35, 0.35 },  //you
                { 0.35, 0.35 },  //show
                { 0.65, 0.80 },  //my
                { 0.45, 0.50 },  //Heart
                { 0.45, 0.5 },   //and
                { 1.1, 0.80 },   //soul
                { 0.35, 0.35 },  // this
                { 0.35, 0.35 },  //time
                { 0.55, 0.55 },  //this
                { 0.55, 0.55 },  //time
                { 0.35, 0.35 },  //my
                { 0.75, 0.75 },  //love
            };
            var angleList = new List <int> {
                0, //I'll
                0, //find
                0, //some
                0, //peace
                0, //this
                0, //time
                0, //i'll
                0, //let
                0, //you
                0, //Know
                0, //we're
                0, //gonna
                0, //grow
                0, //i'm
                0, //gonna
                0, //show
                0, //you
                0, //my
                0, //Heart
                0, //and
                0, //soul
                0, // this
                0, //time
                0, //this
                0, //time
                0, //my
                0, //love
            };
            var colorList = new List <Color4> {
                Color4.White,          //I'll
                Color4.White,          //find
                Color4.White,          //some
                Color4.MediumSeaGreen, //peace
                Color4.White,          //this
                Color4.MediumSeaGreen, //time
                Color4.White,          //i'll
                Color4.White,          //let
                Color4.White,          //you
                Color4.CornflowerBlue, //Know
                Color4.White,          //we're
                Color4.White,          //gonna
                Color4.CornflowerBlue, //grow
                Color4.White,          //i'm
                Color4.White,          //gonna
                Color4.CornflowerBlue, //show
                Color4.White,          //you
                Color4.White,          //my
                Color4.Red,            //Heart
                Color4.White,          //and
                Color4.Red,            //soul
                Color4.White,          // this
                Color4.MediumSeaGreen, //time
                Color4.White,          //this
                Color4.MediumSeaGreen, //time
                Color4.White,          //my
                Color4.Red,            //love
            };
            var run = 0;

            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(positionList[run].Item1, positionList[run].Item2);
                var sprite   = layer.CreateSprite(texture.Path, Origin, position);
                sprite.ScaleVec(line.StartTime, scaleList[run].Item1, scaleList[run].Item2);
                sprite.Fade(line.StartTime - 100, line.StartTime, 0, 1);
                sprite.Fade(line.EndTime - 100, line.EndTime, 1, 0);
                sprite.Rotate(line.EndTime - 100, MathHelper.DegreesToRadians(angleList[run]));
                sprite.Color(line.StartTime, colorList[run]);
                run += 1;
            }
        }
Exemple #16
0
        public void generatePerCharacter(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            var squaresLayer = GetLayer("lyricsSquares");

            foreach (var subtitleLine in subtitles.Lines)
            {
                var letterY    = SubtitleY;
                var i          = 0;
                var lineOffset = 0;
                foreach (var line in subtitleLine.Text.Split('\n'))
                {
                    var lineWidth  = 0f;
                    var lineHeight = 0f;
                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        lineWidth += texture.BaseWidth * FontScale;
                        lineHeight = Math.Max(lineHeight, texture.BaseHeight * FontScale);
                    }

                    var letterX = 320 - lineWidth * 0.5f + lineOffset;
                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        if (!texture.IsEmpty)
                        {
                            var initialPosition = new Vector2(letterX + 40, letterY) + texture.OffsetFor(Origin) * FontScale;

                            var position = new Vector2(letterX, letterY)
                                           + texture.OffsetFor(Origin) * FontScale;

                            var finalPosition = new Vector2(letterX + Random(-15, 15), letterY + Random(-15, 15)) + texture.OffsetFor(Origin) * FontScale;

                            if (squares)
                            {
                                for (int f = 0; f < 3; f++)
                                {
                                    var color = Color;
                                    if (ColorVariance > 0)
                                    {
                                        ColorVariance = MathHelper.Clamp(ColorVariance, 0, 1);

                                        var hsba = Color4.ToHsl(color);
                                        var sMin = Math.Max(0, hsba.Y - ColorVariance * 0.5f);
                                        var sMax = Math.Min(sMin + ColorVariance, 1);
                                        var vMin = Math.Max(0, hsba.Z - ColorVariance * 0.5f);
                                        var vMax = Math.Min(vMin + ColorVariance, 1);

                                        color = Color4.FromHsl(new Vector4(
                                                                   hsba.X,
                                                                   (float)Random(sMin, sMax),
                                                                   (float)Random(vMin, vMax),
                                                                   hsba.W));
                                    }


                                    var initiialRotation = Random(0, MathHelper.DegreesToRadians(360));
                                    var endRotation      = Random(0, MathHelper.DegreesToRadians(360));

                                    var sqaureIinitPos = new Vector2(letterX + Random(-30, 30), letterY + Random(-30, 30)) + texture.OffsetFor(Origin) * FontScale;

                                    var squarePosition = new Vector2(letterX + Random(-15, 15), letterY + Random(-15, 15)) + texture.OffsetFor(Origin) * FontScale;

                                    var square = squaresLayer.CreateSprite("sb/etc/p.png", Origin, squarePosition);
                                    square.Move(subtitleLine.StartTime - 400 + i, subtitleLine.StartTime + i, sqaureIinitPos, squarePosition);
                                    square.Scale(subtitleLine.StartTime - 400 + i, subtitleLine.EndTime, 20, 20);
                                    square.Additive(subtitleLine.StartTime - 400 + i, subtitleLine.EndTime);
                                    square.Fade(subtitleLine.StartTime - 400 + i, subtitleLine.StartTime + i, 0, 0.1);
                                    square.Rotate(subtitleLine.StartTime - 400 + i, subtitleLine.EndTime, initiialRotation, endRotation);
                                    square.Color(subtitleLine.StartTime - 400 + i, color);
                                    square.Fade(subtitleLine.EndTime - 400, subtitleLine.EndTime, 0.1, 0);
                                }
                            }

                            var sprite = layer.CreateSprite(texture.Path, Origin, position);
                            sprite.Move(OsbEasing.Out, subtitleLine.StartTime - 400 + i, subtitleLine.StartTime + i, initialPosition, position);
                            // sprite.Scale(subtitleLine.StartTime - 200 + i, subtitleLine.StartTime + i, 0, FontScale);
                            // sprite.Rotate(OsbEasing.Out, subtitleLine.StartTime - 400 + i, subtitleLine.StartTime + i, MathHelper.DegreesToRadians(Random(0, 360)), MathHelper.DegreesToRadians(0));
                            sprite.Fade(OsbEasing.Out, subtitleLine.StartTime - 400 + i, subtitleLine.StartTime + i, 0, 1);
                            // sprite.MoveY(subtitleLine.StartTime - 200 + i, subtitleLine.StartTime + i, letterY - 15, letterY);
                            sprite.Fade(OsbEasing.In, subtitleLine.EndTime - 400, subtitleLine.EndTime, 1, 0);
                            sprite.Scale(OsbEasing.In, subtitleLine.EndTime - 400, subtitleLine.EndTime, FontScale, 0);
                            sprite.Move(OsbEasing.In, subtitleLine.EndTime - 400, subtitleLine.EndTime, position, finalPosition);

                            if (additive)
                            {
                                sprite.Additive(subtitleLine.StartTime - 400, subtitleLine.EndTime);
                            }
                            i += 65;
                        }
                        letterX += texture.BaseWidth * FontScale;
                    }
                    // lineOffset += 120;
                    letterY += lineHeight;
                }
            }
        }
Exemple #17
0
        public void generatePerCharacter(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var subtitleLine in subtitles.Lines)
            {
                var letterY = SubtitleY;
                foreach (var line in subtitleLine.Text.Split('\n'))
                {
                    var lineWidth  = 0f;
                    var lineHeight = 0f;
                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        lineWidth += texture.BaseWidth * FontScale;
                        lineHeight = Math.Max(lineHeight, texture.BaseHeight * FontScale);
                    }
                    float letterX;

                    int length = subtitleLine.Text.Length;
                    if (length > 30)
                    {
                        letterX = 10;
                    }
                    else if (length > 20)
                    {
                        letterX = 0;
                    }
                    else
                    {
                        letterX = -10;
                    }


                    var initX = letterX;
                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        if (!texture.IsEmpty)
                        {
                            var position = new Vector2(letterX, letterY)
                                           + texture.OffsetFor(Origin) * FontScale;

                            var angle = 15.5155 * Math.PI / 180;

                            var     Radius = position.X - initX;
                            var     x      = Radius * Math.Cos(angle) + initX;
                            var     y      = Radius * Math.Sin(angle) + letterY;
                            Vector2 newPos = new Vector2((float)x, (float)y);

                            Vector2 extraMovement = new Vector2(15f, 5f);

                            Vector2 startPoint = new Vector2(150f, 40f);

                            var layer2 = GetLayer("Background");

                            var redSquare = layer2.CreateSprite("sb/babysquare.png", Origin, newPos);
                            redSquare.Color(subtitleLine.StartTime, 1, 0, 0);
                            redSquare.Fade(subtitleLine.StartTime - 200, subtitleLine.StartTime, 0, 0.15);
                            redSquare.Fade(subtitleLine.EndTime - 200, subtitleLine.EndTime, 0.15, 0);
                            redSquare.Scale(subtitleLine.StartTime, Random(0, 2.5));
                            redSquare.Rotate(subtitleLine.StartTime - 200, subtitleLine.EndTime, Random(-2, 2), Random(-2, 2));

                            var sprite = layer.CreateSprite(texture.Path, Origin, startPoint);
                            sprite.Move(OsbEasing.OutExpo, subtitleLine.StartTime - 200, subtitleLine.StartTime + 200, newPos - startPoint, newPos);
                            sprite.Move(subtitleLine.StartTime + 200, subtitleLine.EndTime, newPos, newPos + extraMovement);
                            sprite.Scale(subtitleLine.StartTime, FontScale);
                            sprite.Fade(subtitleLine.StartTime - 200, subtitleLine.StartTime, 0, 1);
                            sprite.Fade(subtitleLine.EndTime - 200, subtitleLine.EndTime, 1, 0);
                            sprite.Rotate(subtitleLine.StartTime, angle);
                            sprite.Scale(subtitleLine.StartTime - 200, subtitleLine.StartTime, 0.05, 0.25);

                            if (additive)
                            {
                                sprite.Additive(subtitleLine.StartTime - 200, subtitleLine.EndTime);
                            }
                        }
                        letterX += texture.BaseWidth * FontScale;
                    }
                    letterY += lineHeight;
                }
            }
        }
Exemple #18
0
        public void generatePerCharacter(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, string TimestampSplit)
        {
            var TimestampArray = Array.ConvertAll(TimestampSplit.Split(','), s => int.Parse(s));
            var LineStart      = 0;
            var LineEnd        = 0;
            var RunLine        = 0f;
            var aniLyrics      = 0;

            var trace = layer.CreateSprite(TracePath, OsbOrigin.Centre);

            if (StartTrace == 49997)
            {
                trace.Move(StartTrace - tick(0, 2) - tick(0, 1), StartTrace - tick(0, 1), new Vector2(-120, 400), new Vector2(70, 400));
                trace.Fade(StartTrace - tick(0, 2) - tick(0, 1), StartTrace - tick(0, 1), 0, 0.65);
                trace.ScaleVec(StartTrace - tick(0, 2) - tick(0, 1), StartTrace - tick(0, 1), 0, 0.15, 0.22, 0.15);
                trace.Color(StartTrace - tick(0, 2) - tick(0, 1), 0, 0, 0);
                trace.Fade(EndTrace - tick(0, 0.5), EndTrace, 0.65, 0);
            }
            else
            {
                trace.FlipH(StartTrace - tick(0, 2) - tick(0, 1), EndTrace);
                trace.FlipV(StartTrace - tick(0, 2) - tick(0, 1), EndTrace);
                trace.Move(StartTrace - tick(0, 2) - tick(0, 1), StartTrace - tick(0, 1), new Vector2(730, 400), new Vector2(540, 400));
                trace.Fade(StartTrace - tick(0, 2) - tick(0, 1), StartTrace - tick(0, 1), 0, 0.65);
                trace.ScaleVec(StartTrace - tick(0, 2) - tick(0, 1), StartTrace - tick(0, 1), 0, 0.15, 0.22, 0.15);
                trace.Color(StartTrace - tick(0, 2) - tick(0, 1), 0, 0, 0);
                trace.Fade(EndTrace - tick(0, 0.5), EndTrace, 0.65, 0);
            }

            foreach (var subtitleLine in subtitles.Lines)
            {
                foreach (var line in subtitleLine.Text.Split('\0'))
                {
                    var letterX = SubtitleX;
                    var letterY = SubtitleY;

                    var lineWidth  = 0f;
                    var lineHeight = 0f;

                    for (int x = 0; x < TimestampArray.Length; x++)
                    {
                        if (LineStart == TimestampArray[x])
                        {
                            continue;
                        }
                        if (TimestampArray[x] <= subtitleLine.StartTime && TimestampArray[x + 1] >= subtitleLine.StartTime)
                        {
                            LineStart = TimestampArray[x];
                            LineEnd   = TimestampArray[x + 1];
                            RunLine   = 0f;
                            aniLyrics = 0;
                            break;
                        }
                    }

                    foreach (var letter in line)
                    {
                        var texture = font.GetTexture(letter.ToString());
                        lineWidth += texture.BaseWidth * FontScale;
                        lineHeight = Math.Max(lineHeight, texture.BaseHeight * FontScale);
                        if (!texture.IsEmpty)
                        {
                            var position = new Vector2(letterX + RunLine, letterY)
                                           + texture.OffsetFor(Origin) * FontScale;
                            var sprite = layer.CreateSprite(texture.Path, Origin);
                            if (letter == '$')
                            {
                                letterX += texture.BaseWidth * FontScale;
                                continue;
                            }
                            //begin
                            sprite.Scale(LineStart + aniLyrics - tick(0, 0.5) + tick(0, 2), FontScale - 0.2f);
                            sprite.Fade(LineStart + aniLyrics - tick(0, 0.5) + tick(0, 2), LineStart + aniLyrics - tick(0, 0.75), 0, 0.4);
                            sprite.Move(LineStart + aniLyrics - tick(0, 0.5) + tick(0, 2), LineStart + aniLyrics - tick(0, 0.75), position - new Vector2(0, 20), position);
                            //pulse
                            sprite.Scale(subtitleLine.StartTime - 50, subtitleLine.StartTime + 50, FontScale - 0.2f, FontScale);
                            sprite.Fade(subtitleLine.StartTime - 50, subtitleLine.StartTime + 50, 0.4, 1);
                            //end
                            sprite.Scale(subtitleLine.StartTime + 50, subtitleLine.EndTime + tick(0, 1), FontScale, FontScale - 0.2f);
                            sprite.Fade(subtitleLine.StartTime + 50, subtitleLine.EndTime + tick(0, 1), 1, 0);
                        }
                        letterX += texture.BaseWidth * FontScale;
                    }
                    RunLine   += letterX - SubtitleX;
                    letterY   += lineHeight;
                    aniLyrics += 40;
                }
            }
        }