func drawLines(ctx *nanovgo.Context, x, y, w, h, t float32) { var pad float32 = 5.0 s := w/9.0 - pad*2 joins := []nanovgo.LineCap{nanovgo.Miter, nanovgo.Round, nanovgo.Bevel} caps := []nanovgo.LineCap{nanovgo.Butt, nanovgo.Round, nanovgo.Square} ctx.Save() defer ctx.Restore() pts := []float32{ -s*0.25 + cosF(t*0.3)*s*0.5, sinF(t*0.3) * s * 0.5, -s * 0.25, 0, s * 0.25, 0, s*0.25 + cosF(-t*0.3)*s*0.5, sinF(-t*0.3) * s * 0.5, } for i, cap := range caps { for j, join := range joins { fx := x + s*0.5 + float32(i*3+j)/9.0*w + pad fy := y - s*0.5 + pad ctx.SetLineCap(cap) ctx.SetLineJoin(join) ctx.SetStrokeWidth(s * 0.3) ctx.SetStrokeColor(nanovgo.RGBA(0, 0, 0, 160)) ctx.BeginPath() ctx.MoveTo(fx+pts[0], fy+pts[1]) ctx.LineTo(fx+pts[2], fy+pts[3]) ctx.LineTo(fx+pts[4], fy+pts[5]) ctx.LineTo(fx+pts[6], fy+pts[7]) ctx.Stroke() ctx.SetLineCap(nanovgo.Butt) ctx.SetLineJoin(nanovgo.Bevel) ctx.SetStrokeWidth(1.0) ctx.SetStrokeColor(nanovgo.RGBA(0, 192, 255, 255)) ctx.BeginPath() ctx.MoveTo(fx+pts[0], fy+pts[1]) ctx.LineTo(fx+pts[2], fy+pts[3]) ctx.LineTo(fx+pts[4], fy+pts[5]) ctx.LineTo(fx+pts[6], fy+pts[7]) ctx.Stroke() } } }