using UnityEngine; using UnityEngine.UIElements; namespace Soundings { public sealed partial class SoundingsApp { private void DrawTitleWordmark(VisualElement intro) { var mark = Add(intro, "title-wordmark"); var line = Add(mark, "title-wordmark-line"); AddDisplay(line, "BIG SHI", "title-wordmark-lead"); var letter = Add(line, "title-overpaint"); AddDisplay(letter, "T", "title-wordmark-lead title-underpaint"); var paint = Add(letter, "title-spray-letter"); paint.pickingMode = PickingMode.Ignore; paint.generateVisualContent += DrawSprayPaint; AddDisplay(mark, "TYCOON", "title-wordmark-main"); } private static void DrawSprayPaint(MeshGenerationContext context) { Rect area = context.visualElement.contentRect; float scale = Mathf.Min(area.width / 63, area.height / 82); if (scale <= 0) return; Vector2 Point(float x, float y) => new Vector2(x, y) * scale; Painter2D pen = context.painter2D; pen.lineCap = LineCap.Round; pen.lineJoin = LineJoin.Round; void Stroke(float width, Color32 tone) { pen.strokeColor = tone; pen.lineWidth = width * scale; pen.BeginPath(); pen.MoveTo(Point(17, 70)); pen.LineTo(Point(25, 46)); pen.LineTo(Point(29, 17)); pen.LineTo(Point(42, 13)); pen.BezierCurveTo(Point(58, 12), Point(63, 32), Point(49, 37)); pen.LineTo(Point(25, 43)); pen.Stroke(); } Stroke(16, new Color32(245, 88, 48, 34)); Stroke(12, new Color32(250, 98, 58, 110)); Stroke(8, new Color32(248, 109, 68, 248)); pen.lineWidth = 2.2f * scale; pen.BeginPath(); pen.MoveTo(Point(19, 62)); pen.LineTo(Point(16, 76)); pen.MoveTo(Point(51, 35)); pen.LineTo(Point(50, 48)); pen.Stroke(); var spray = new System.Random(517); for (int i = 0; i < 67; i++) { float along = (float)spray.NextDouble(); bool stem = i < 38; float x = stem ? Mathf.Lerp(17, 31, along) : Mathf.Lerp(26, 57, along); float y = stem ? Mathf.Lerp(70, 16, along) : 25 - 12 * Mathf.Sin(along * Mathf.PI); x += (float)spray.NextDouble() * 19 - 9.5f; y += (float)spray.NextDouble() * 13 - 6.5f; pen.fillColor = new Color32(252, 112, 75, (byte)spray.Next(27, 174)); pen.BeginPath(); pen.Arc(Point(x, y), (float)(.24 + spray.NextDouble() * .46) * scale, 0, 360); pen.Fill(); } } } }