experimental SVG-based video rendering engine made for music videos. React to MIDI or arbitrary signals from your DAW through "probe" VSTs
1use measure_time::debug_time;
2
3use super::SVGAttributesRenderable;
4use crate::{ColorMapping, ObjectSizes, Transformation};
5use std::collections::HashMap;
6
7impl SVGAttributesRenderable for Transformation {
8 const MULTIPLE_VALUES_JOIN_BY: &'static str = " ";
9
10 fn render_to_svg_attributes(
11 &self,
12 _colormap: ColorMapping,
13 _cell_size: usize,
14 _object_sizes: ObjectSizes,
15 _id: &str,
16 ) -> anyhow::Result<HashMap<String, String>> {
17 debug_time!("render_to_svg/transformation");
18 Ok(HashMap::from([(
19 "transform".to_string(),
20 match self {
21 Transformation::Scale(x, y) => format!("scale({} {})", x, y),
22 Transformation::Rotate(angle) => format!("rotate({})", angle),
23 Transformation::Skew(x, y) => {
24 format!("skewX({}) skewY({})", x, y)
25 }
26 Transformation::Matrix(a, b, c, d, e, f) => {
27 format!("matrix({}, {}, {}, {}, {}, {})", a, b, c, d, e, f)
28 }
29 },
30 )]))
31 }
32}