experimental SVG-based video rendering engine made for music videos. React to MIDI or arbitrary signals from your DAW through "probe" VSTs
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

🚧 Postamble motif

gwen.works c2a5cdb8 e928fb48

verified
+223
+11
examples/postamble-motif/Cargo.toml
··· 1 + [package] 2 + name = "postamble-motif" 3 + version = "0.1.0" 4 + edition = "2024" 5 + 6 + [dependencies] 7 + base64 = "0.22.1" 8 + enum2str = "0.1.16" 9 + rand = "0.9.1" 10 + shapemaker = { version = "1.2.2", path = "../.." } 11 + svg = "0.18.0"
+17
examples/postamble-motif/letters/a.svg
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 207.54 203.5"> 3 + <defs> 4 + <style> 5 + .cls-1 { 6 + fill: none; 7 + stroke: red; 8 + stroke-miterlimit: 10; 9 + stroke-width: 17px; 10 + } 11 + </style> 12 + </defs> 13 + <g id="a"> 14 + <rect class="cls-1" x="8.5" y="8.5" width="128.56" height="128.99"/> 15 + <line class="cls-1" x1="201.77" y1="197.26" x2="137.06" y2="137.49"/> 16 + </g> 17 + </svg>
+16
examples/postamble-motif/letters/b.svg
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 145.99 137.49"> 3 + <defs> 4 + <style> 5 + .cls-1 { 6 + fill: none; 7 + stroke: red; 8 + stroke-miterlimit: 10; 9 + stroke-width: 17px; 10 + } 11 + </style> 12 + </defs> 13 + <g id="b"> 14 + <polyline class="cls-1" points="8.5 0 8.5 128.99 137.49 128.99 137.49 59.77 8.5 59.77"/> 15 + </g> 16 + </svg>
+16
examples/postamble-motif/letters/e.svg
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 73.21 86.23"> 3 + <defs> 4 + <style> 5 + .cls-1 { 6 + fill: none; 7 + stroke: red; 8 + stroke-miterlimit: 10; 9 + stroke-width: 17px; 10 + } 11 + </style> 12 + </defs> 13 + <g id="e"> 14 + <path class="cls-1" d="M73.21,77.73H8.5V8.5h48.94c5.99,0,9.09,7.15,5,11.52L8.5,77.73"/> 15 + </g> 16 + </svg>
+16
examples/postamble-motif/letters/l.svg
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 137.06 137.49"> 3 + <defs> 4 + <style> 5 + .cls-1 { 6 + fill: none; 7 + stroke: red; 8 + stroke-miterlimit: 10; 9 + stroke-width: 17px; 10 + } 11 + </style> 12 + </defs> 13 + <g id="l"> 14 + <polyline class="cls-1" points="8.5 0 8.5 128.99 137.06 128.99"/> 15 + </g> 16 + </svg>
+21
examples/postamble-motif/letters/m.svg
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 146.42 137.51"> 3 + <defs> 4 + <style> 5 + .cls-1 { 6 + fill: none; 7 + stroke: red; 8 + stroke-miterlimit: 10; 9 + stroke-width: 17px; 10 + } 11 + </style> 12 + </defs> 13 + <g id="m"> 14 + <g> 15 + <polyline class="cls-1" points="8.5 137.49 8.5 8.5 73 8.5 137.92 8.5 137.92 137.49"/> 16 + <line class="cls-1" x1="73.21" y1="137.49" x2="73" y2="8.5"/> 17 + <line class="cls-1" x1="105.67" y1="8.5" x2="105.67" y2="137.49"/> 18 + <line class="cls-1" x1="41.61" y1="8.5" x2="41.61" y2="137.49"/> 19 + </g> 20 + </g> 21 + </svg>
+16
examples/postamble-motif/letters/o.svg
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 145.56 145.99"> 3 + <defs> 4 + <style> 5 + .cls-1 { 6 + fill: none; 7 + stroke: red; 8 + stroke-miterlimit: 10; 9 + stroke-width: 17px; 10 + } 11 + </style> 12 + </defs> 13 + <g id="o"> 14 + <rect class="cls-1" x="8.5" y="8.5" width="128.56" height="128.99"/> 15 + </g> 16 + </svg>
+16
examples/postamble-motif/letters/p.svg
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 145.99 266.48"> 3 + <defs> 4 + <style> 5 + .cls-1 { 6 + fill: none; 7 + stroke: red; 8 + stroke-miterlimit: 10; 9 + stroke-width: 17px; 10 + } 11 + </style> 12 + </defs> 13 + <g id="p"> 14 + <polyline class="cls-1" points="8.5 266.48 8.5 8.5 137.49 8.5 137.49 137.49 8.5 137.49"/> 15 + </g> 16 + </svg>
+16
examples/postamble-motif/letters/s.svg
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 146.95 145.99"> 3 + <defs> 4 + <style> 5 + .cls-1 { 6 + fill: none; 7 + stroke: red; 8 + stroke-miterlimit: 10; 9 + stroke-width: 17px; 10 + } 11 + </style> 12 + </defs> 13 + <g id="s"> 14 + <path class="cls-1" d="M146.95,8.5H8.5v64.5h120.16c5.12,0,9.26,4.15,9.26,9.26v55.23H8.5"/> 15 + </g> 16 + </svg>
+19
examples/postamble-motif/letters/t.svg
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 137.49 137.49"> 3 + <defs> 4 + <style> 5 + .cls-1 { 6 + fill: none; 7 + stroke: red; 8 + stroke-miterlimit: 10; 9 + stroke-width: 17px; 10 + } 11 + </style> 12 + </defs> 13 + <g id="t"> 14 + <g> 15 + <polyline class="cls-1" points="137.49 128.99 8.5 128.99 8.5 59.61 8.5 0"/> 16 + <line class="cls-1" x1="73" y1="60.63" x2="8.5" y2="60.63"/> 17 + </g> 18 + </g> 19 + </svg>
+1
examples/postamble-motif/out.svg
··· 1 + <svg width="1370" height="2420" viewBox="-10 -10 1370 2420" xmlns="http://www.w3.org/2000/svg" ><rect x="-10" fill="white" y="-10" width="1370" height="2420" /><g class="layer" data-layer="root" ><image data-object="root--dIeOhbYYVycAvflNl2gTS" height="100" x="0" width="50" href="C:\Users\ewen\projects.local\shapemaker\examples\postamble-motif/letters/p.svg" y="0" style="" /><image data-object="root--6g9SoCwTTpV2LtY-4rH8H" height="50" width="50" x="50" href="C:\Users\ewen\projects.local\shapemaker\examples\postamble-motif/letters/o.svg" y="0" style="" /></g><defs /></svg>
+58
examples/postamble-motif/src/main.rs
··· 1 + use enum2str::EnumStr; 2 + use shapemaker::*; 3 + 4 + fn main() { 5 + let mut canvas = Canvas::new(27, 48); 6 + canvas.set_background(Color::White); 7 + canvas 8 + .root() 9 + .add_anon(Letter::P.object(Region::new(0, 0, 0, 1).unwrap())); 10 + canvas 11 + .root() 12 + .add_anon(Letter::O.object(Region::new(1, 0, 1, 0).unwrap())); 13 + 14 + canvas 15 + .render_to_svg_file("out.svg") 16 + .expect("Failed to render SVG"); 17 + canvas 18 + .render_to_png("out.png", 500) 19 + .expect("Failed to render PNG"); 20 + } 21 + 22 + #[derive(Debug, Clone, Copy, EnumStr)] 23 + enum Letter { 24 + P, 25 + O, 26 + S, 27 + T, 28 + A, 29 + M, 30 + B, 31 + L, 32 + E, 33 + } 34 + 35 + impl Letter { 36 + fn object(&self, at: Region) -> ColoredObject { 37 + Image( 38 + at, 39 + // format!( 40 + // "data:image/svg+xml;base64,{}", 41 + // BASE64.encode( 42 + // fs::read_to_string(format!( 43 + // "./letters/{}.svg", 44 + // self.to_string().to_lowercase() 45 + // )) 46 + // .expect("Letter {self} not found") 47 + // .replace(r#"<?xml version="1.0" encoding="UTF-8"?>"#, ""), 48 + // ) 49 + // ), 50 + format!( 51 + "{}/letters/{}.svg", 52 + std::path::absolute(".").unwrap().display(), 53 + self.to_string().to_lowercase() 54 + ), 55 + ) 56 + .into() 57 + } 58 + }