Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
raea check's contrast reads a moving text where it is on its middle frame, not where it ends (#236): a run's box on that frame is its last box moved back by how far its letters travel
shinyobjectz53f9cba21530
diff --git a/apps/check/src/picture.rs b/apps/check/src/picture.rsindex 25480d4d..2bcecf08 100644--- a/apps/check/src/picture.rs+++ b/apps/check/src/picture.rs@@ -199,19 +199,19 @@ pub(crate) fn blotching_from(video: &str, probe: &Probe, scores: &[Option<f64>],}}-/// Caption contrast: at each text's middle frame, the pixels behind it against its colour, at least 3:1. The pixels+/// Caption contrast: at each text's middle frame, the pixels behind it where it is on that frame against its colour, at+/// least 3:1. The pixels/// behind are the half of the box least like the text.pub(crate) fn contrast(video: &str, runs: &[Run], w: f64, h: f64, probe: &Probe, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {let (sx, sy) = (probe.w / w, probe.h / h);let mut low = 0;let mut measured = 0;for r in runs.iter().filter(|r| r.size >= 20.0).take(80) {- let [x, y, bw, bh] = r.box_;+ let (t, [x, y, bw, bh]) = r.middle(probe.fps);let crop = [(x * sx).max(0.0) as u32, (y * sy).max(0.0) as u32, (bw * sx) as u32, (bh * sy) as u32];if crop[0] + crop[2] > probe.w as u32 || crop[1] + crop[3] > probe.h as u32 {continue;}- let t = (r.from + r.to) / 2.0;// the same measure `raea world` joins to a text from its render (raea-sys-measure, DR2)let ratio = if crate::read::native() { crate::read::contrast(video, t, crop, &r.color) } else { raea_sys_measure::contrast(std::path::Path::new(video), t, crop, &r.color) };let Some(ratio) = ratio else { continue };diff --git a/apps/check/src/tests.rs b/apps/check/src/tests.rsindex 144fb1f9..e4d31e5b 100644--- a/apps/check/src/tests.rs+++ b/apps/check/src/tests.rs@@ -420,3 +420,15 @@ fn things_found_are_findings_and_an_unknown_rule_is_not() {let _ = std::fs::remove_file(&p);assert_eq!(passed.len(), 1, "nothing found is a pass");}++/// #236: a text that moves is read where it is on its middle frame, not where it ends.+#[test]+fn a_moving_text_is_read_where_it_is() {+ let ink = |f: usize| [56.7 + 4.0 * f as f64, 1000.0, 26.7, 40.0];+ let run = Run { text: "E".into(), from: 0.0, to: 8.0, box_: [996.0, 1000.0, 60.0, 40.0], boxes: (0..240).map(ink).collect(), color: String::new(), size: 40.0 };+ let (t, b) = run.middle(30.0);+ assert_eq!(t, 4.0);+ assert!((b[0] - 520.0).abs() < 1e-9 && b[1..] == [1000.0, 60.0, 40.0], "{b:?}");+ let still = Run { boxes: vec![ink(0); 240], box_: [40.0, 1000.0, 60.0, 40.0], ..run };+ assert_eq!(still.middle(30.0), (4.0, [40.0, 1000.0, 60.0, 40.0]));+}diff --git a/apps/check/text/src/lib.rs b/apps/check/text/src/lib.rsindex 5ec319c7..b80212e8 100644--- a/apps/check/text/src/lib.rs+++ b/apps/check/text/src/lib.rs@@ -47,6 +47,18 @@ pub struct Run {pub size: f64,}+impl Run {+ /// The frame midway through those that show its whole text, and its box on that frame: `box_` (the last frame's)+ /// moved back by how far its letters travel from there to where they end. A text that moves was read at its last+ /// place on its middle frame (#236).+ pub fn middle(&self, fps: f64) -> (f64, [f64; 4]) {+ let n = self.boxes.len();+ let (Some(last), true) = (self.boxes.last(), fps > 0.0 && n > 1) else { return ((self.from + self.to) / 2.0, self.box_) };+ let (at, [x, y, w, h]) = (self.boxes[n / 2], self.box_);+ (self.to - (n - n / 2) as f64 / fps, [x + at[0] - last[0], y + at[1] - last[1], w, h])+ }+}+/// The brand kit the cut was styled from (brand/ at or above the manifest's or the video's folder, as render finds/// brand.css): a kit `raea brand` read from a thin fetch that nobody corrected by hand is a placeholder, P1; a brand.css/// with no brand.json beside it wasn't read from the brand at all, P2