this repo has no description
3
fork

Configure Feed

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

✨ Improve API

+32 -5
+12 -1
src/geometry/angle.rs
··· 10 10 } 11 11 12 12 pub fn from_radians(radians: f32) -> Self { 13 - Self(radians * Self::TURN.0 / std::f32::consts::TAU) 13 + Self::from_ratio(radians, std::f32::consts::TAU) 14 + } 15 + 16 + /// Creates an angle given an amount, and what a full turn is equal to 17 + /// ``` 18 + /// use shapemaker::geometry::Angle; 19 + /// 20 + /// assert_eq!(Angle::from_ratio(0.5, 1.0).degrees() as usize, 180); 21 + /// assert_eq!(Angle::from_radians(std::f32::consts::TAU).degrees() as usize, 360); 22 + /// ``` 23 + pub fn from_ratio(amount: f32, of: f32) -> Self { 24 + Self(amount * Self::TURN.0 / of) 14 25 } 15 26 16 27 pub fn degrees(&self) -> f32 {
+1
src/lib.rs
··· 43 43 pub use video::{ 44 44 Animation, AttachHooks, Scene, Timestamp, Video, animation, context, 45 45 }; 46 + pub use synchronization::audio::MusicalDurationUnit::*; 46 47 47 48 trait Toggleable { 48 49 fn toggle(&mut self);
+1 -1
src/synchronization/audio.rs
··· 98 98 99 99 pub enum MusicalDurationUnit { 100 100 Beats, 101 - Halfs, 101 + Halves, 102 102 Thirds, 103 103 Quarters, 104 104 Eighths,
+18 -3
src/video/hooks.rs
··· 77 77 }) 78 78 } 79 79 80 + fn assign_scene_to( 81 + self, 82 + marker_text: &'static str, 83 + scene_name: &'static str, 84 + ) -> Self { 85 + self.with_hook(Hook { 86 + when: Box::new(move |_, context, _, _| { 87 + context.marker() == marker_text 88 + }), 89 + render_function: Box::new(move |_, context| { 90 + context.switch_scene(scene_name); 91 + Ok(()) 92 + }), 93 + }) 94 + } 95 + 80 96 fn each_beat( 81 97 self, 82 98 render_function: &'static RenderFunction<AdditionalContext>, ··· 104 120 ) -> Self { 105 121 let beats = match unit { 106 122 MusicalDurationUnit::Beats => amount, 107 - MusicalDurationUnit::Halfs => amount / 2.0, 123 + MusicalDurationUnit::Halves => amount / 2.0, 108 124 MusicalDurationUnit::Quarters => amount / 4.0, 109 125 MusicalDurationUnit::Eighths => amount / 8.0, 110 126 MusicalDurationUnit::Sixteenths => amount / 16.0, ··· 133 149 ) -> Self { 134 150 self.with_hook(Hook { 135 151 when: Box::new(move |_, context, _, previous_rendered_frame| { 136 - context.frame() != previous_rendered_frame 137 - && context.frame() % n == 0 152 + context.frame() - previous_rendered_frame >= n 138 153 }), 139 154 render_function: Box::new(render_function), 140 155 })