Skip to main content

alpha2_eval/
shutter.rs

1use crate::{EvaluatedVisual, FrameShutter, SampleContext, sample_visual};
2use alpha2_model::VisualProperties;
3use alpha2_time::MediaTime;
4
5/// The transform at each of `count` shutter samples of the frame at `time`, into `out`.
6///
7/// `time` is in the clock `properties` is keyed in: timeline time for a clip, composition time
8/// for a transform step. Keyframes and data bindings are read at each sample's own instant, as
9/// [`sample_visual`] reads them at one.
10pub fn sample_shutter(
11    properties: &VisualProperties,
12    shutter: &FrameShutter,
13    time: MediaTime,
14    count: u32,
15    aspect: f64,
16    context: &SampleContext<'_>,
17    out: &mut Vec<EvaluatedVisual>,
18) {
19    out.clear();
20    out.extend((0..count).map(|index| {
21        sample_visual(
22            properties,
23            shutter.sample_time(time, index, count),
24            aspect,
25            context,
26        )
27    }));
28}
29
30#[cfg(test)]
31#[path = "shutter_tests.rs"]
32mod tests;