From f8d3a32f4f995eeb7e162b0702998b0565c11e4e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 12:10:40 -0300 Subject: sketchbook: a scene file says its page colour (background) --- src/anim/player.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/anim/player.zig') diff --git a/src/anim/player.zig b/src/anim/player.zig index bac5178..090b6cb 100644 --- a/src/anim/player.zig +++ b/src/anim/player.zig @@ -26,6 +26,8 @@ const typst = @import("typst"); const geom = vector.geom; pub const name = if (@hasDecl(scene_file, "name")) scene_file.name else "anim"; +/// The page: the scene file's `background` (0xRRGGBB), or manim's. +const background: u32 = if (@hasDecl(scene_file, "background")) scene_file.background else anim.background; /// The scene's frame, in scene units: what shows at camera zoom 1. pub const width = 1280; pub const height = 720; @@ -234,7 +236,7 @@ fn paint(s: *const State, ss: *Session, layers: anytype, f: *sk.Frame, shot: ani const world = stage(s, shot.camera, canvas); var used: usize = 0; // The first layer is the background too. - var open: ?*@TypeOf(layers.items[0]) = try begun(layers, &used, f, canvas, anim.color(anim.background)); + var open: ?*@TypeOf(layers.items[0]) = try begun(layers, &used, f, canvas, anim.color(background)); var shapes: usize = 0; for (shot.objects, shot.poses, 0..) |o, pose, i| { if (!pose.visible or pose.opacity <= 0) continue; -- cgit v1.3