clone

a self-hosted multitenant nostr relay with sites, file storage, git hosting, and inbox and outbox delivery

feat/standalone-relay
tinyrelay / internal / seedmark / families_b.go
families_b.go 5.4K
1package seedmark23import "fmt"45func landscapes(r recipe) string {6 bg, light, hot, cool := r.Palette[0], r.Palette[1], r.Palette[2], r.Palette[3]7 s, h := r.Silhouette.Variant, r.Silhouette.Height8 f, accent := r.Features.Variant, r.Features.Accent9 horizon := 31 + (float64(h)-28)/210 art := []string{11 circle(22, 19, 9, hot),12 circle(43, 19, 10, hot),13 rect(14, 12, 34, 9, 4, hot),14 circle(32, 21, 15, hot),15 }[r.Layout.Variant]16 art += []string{17 path("M7 46L21 22L33 37L43 26L57 46V55H7Z", cool),18 path(fmt.Sprintf("M7 %sQ18 21 31 %sQ46 22 57 35V55H7Z", num(horizon), num(horizon)), cool),19 path("M8 53V25H20V38H30V19H40V32H55V53Z", cool),20 path("M7 36L18 28L26 32L39 23L57 33V55H7Z", cool),21 }[s]22 if f == 0 {23 art += path("M31 35L24 45L36 45L28 55H42L45 43L33 43L37 35Z", light)24 }25 if f == 1 {26 art += strokePath("M9 45Q21 40 32 46T55 46M13 53Q23 48 35 53", "none", light, 4)27 }28 if f == 2 {29 art += strokePath("M18 48V35M12 42L18 32L24 42ZM42 50V38M36 43L42 33L48 43Z", light, light, 2)30 }31 if f == 3 {32 art += rect(26, 36, 15, 17, 2, light) + path("M23 36L33 27L44 36Z", light) + rect(31, 43, 5, 10, 0, bg)33 }34 if accent != 0 {35 art += strokePath("M9 18Q13 13 17 18Q21 13 25 18", "none", light, 2)36 } else {37 art += circle(51, 12, 3, light)38 }39 return art40}4142func glyphs(r recipe) string {43 bg, light, hot, cool := r.Palette[0], r.Palette[1], r.Palette[2], r.Palette[3]44 w := float64(r.Silhouette.Width)45 f, accent := r.Features.Variant, r.Features.Accent46 art := []string{47 circle(32, 32, 24, cool) + circle(32, 32, 18, bg),48 rect(10, 10, 44, 44, 10, cool) + rect(16, 16, 32, 32, 5, bg),49 strokePath("M10 26L26 10M38 10L54 26M54 38L38 54M26 54L10 38", "none", cool, 6),50 strokePath("M10 47V17H24M54 17V47H40", "none", cool, 6),51 }[r.Layout.Variant]52 a, b := 32-w/2+4, 64-(32-w/2+4)53 art += []string{54 strokePath(fmt.Sprintf("M%s 43L32 17L%s 43M24 35H40", num(a), num(b)), "none", light, 7),55 strokePath(fmt.Sprintf("M%s 22H%sL%s 43H%s", num(a), num(b), num(a), num(b)), "none", light, 7),56 strokePath(fmt.Sprintf("M%s 19V44H%sV19M32 20V39", num(a), num(b)), "none", light, 7),57 path("M21 18H37Q49 24 37 32Q50 40 38 46H21Z", light) + rect(27, 24, 9, 5, 2, bg) + rect(27, 36, 10, 5, 2, bg),58 }[r.Silhouette.Variant]59 art += []string{60 circle(32, 32, 5, hot),61 path("M32 24L40 32L32 40L24 32Z", hot),62 rect(26, 27, 12, 10, 2, hot),63 strokePath("M22 37L42 27", "none", hot, 6),64 }[f]65 if accent != 0 {66 art += circle(49, 15, 4, light)67 } else {68 art += circle(15, 49, 4, light)69 }70 return art71}7273func woven(r recipe) string {74 bg, light, hot, cool := r.Palette[0], r.Palette[1], r.Palette[2], r.Palette[3]75 s, w := r.Silhouette.Variant, float64(r.Silhouette.Width)76 f, count := r.Features.Variant, r.Features.Count77 gap := 10 + (w-26)/678 art := ""79 if s == 0 {80 for i := 0; i < 3; i++ {81 fill := light82 if i%2 != 0 {83 fill = hot84 }85 art += rect(13+float64(i)*gap, 10, 7, 44, 3, fill)86 }87 for i := 0; i < 3; i++ {88 art += rect(9, 16+float64(i)*gap, 45, 6, 2, cool)89 }90 art += rect(24, 23, 7, 15, 2, hot)91 }92 if s == 1 {93 for i := 0; i < 3; i++ {94 colors := []string{light, hot, cool}95 x := 12 + i*1296 art += strokePath(fmt.Sprintf("M%d 12L%d 25L%d 39L%d 52", x, x+8, x, x+8), "none", colors[i], 8)97 }98 }99 if s == 2 {100 art += strokePath("M12 20Q12 11 22 11H43Q52 11 52 21V43Q52 53 42 53H22Q12 53 12 43Z", "none", light, 6)101 art += strokePath("M21 10V44H43V20H10M54 32H32V54", "none", hot, 7)102 art += rect(28, 22, 8, 8, 1, cool)103 }104 if s == 3 {105 for i := 0; i < 3; i++ {106 colors := []string{light, hot, cool}107 y := 18 + i*13108 art += path(fmt.Sprintf("M10 %dL22 %dL34 %dL46 %dL54 %dL46 %dL34 %dL22 %dZ", y, 10+i*13, y, 10+i*13, y, 26+i*13, y, 26+i*13), colors[i])109 }110 }111 art = group(art, fmt.Sprintf("rotate(%d 32 32) scale(.88) translate(4.36 4.36)", r.Layout.Variant*45))112 art += []string{113 circle(32, 32, 5, bg) + circle(32, 32, 2, light),114 rect(26, 26, 12, 12, 3, hot),115 path("M32 24L40 32L32 40L24 32Z", cool),116 strokePath("M27 28L37 36M37 28L27 36", "none", bg, 4),117 }[f]118 for i := 0; i < count; i++ {119 art += circle(18+float64(i)*7, 56, 2, hot)120 }121 return art122}123124func machines(r recipe) string {125 bg, light, hot, cool := r.Palette[0], r.Palette[1], r.Palette[2], r.Palette[3]126 s, w := r.Silhouette.Variant, float64(r.Silhouette.Width)127 f, count, accent := r.Features.Variant, r.Features.Count, r.Features.Accent128 x := 32 - w/2129 art := []string{130 strokePath("M22 23L17 11M42 23L49 11", "none", hot, 4) + circle(17, 11, 4, light),131 rect(23, 9, 18, 16, 4, hot) + rect(28, 12, 8, 6, 1, bg),132 strokePath("M12 27L8 39L19 44M51 27L56 39L47 44", "none", hot, 6),133 circle(22, 49, 8, hot) + circle(43, 49, 8, hot),134 }[r.Layout.Variant]135 art += []string{136 rect(x, 20, w, 30, 5, light),137 path(fmt.Sprintf("M%s 19H%sL%s 45L41 52H23L%s 45Z", num(x+5), num(59-x), num(64-x), num(x)), light),138 ellipse(32, 35, w/2, 18, light),139 path("M23 17H41L52 29V44L41 52H23L12 44V29Z", light),140 }[s]141 if f == 0 {142 art += circle(32, 34, 11, bg) + circle(32, 34, 7, cool) + circle(35, 31, 3, light)143 }144 if f == 1 {145 art += rect(20, 26, 24, 17, 3, bg) + strokePath("M24 37L29 30L34 36L40 29", "none", cool, 3)146 }147 if f == 2 {148 art += rect(19, 25, 26, 15, 2, bg)149 for i := 0; i < count; i++ {150 art += rect(22+float64(i)*4, 28, 2, 9, 1, cool)151 }152 }153 if f == 3 {154 art += circle(25, 32, 6, bg) + circle(39, 32, 6, bg) + strokePath("M20 44H44", "none", hot, 4)155 }156 if accent != 0 {157 art += circle(43, 46, 3, hot)158 } else {159 art += circle(21, 46, 3, hot)160 }161 return art162}