#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Motion {
#[default]
Full,
Reduced,
Off,
}
impl Motion {
pub fn amplitude(self) -> f32 {
match self {
Motion::Full => 1.0,
Motion::Reduced => 0.3,
Motion::Off => 0.0,
}
}
}
pub(crate) const REDUCED_DECAY_SECS: f32 = 1.0;
pub(crate) const STEADY_GLOW: f32 = 0.6;
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub struct RevealOptions {
pub chars_per_sec: f32,
pub comma_pause: f32,
pub period_pause: f32,
pub motion: Motion,
pub blip: Option<Blip>,
pub auto: AutoWait,
}
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub struct AutoWait {
pub base: f32,
pub per_char: f32,
pub max: f32,
pub after_voice: f32,
}
impl Default for AutoWait {
fn default() -> Self {
Self {
base: 1.0,
per_char: 0.05,
max: 8.0,
after_voice: 0.5,
}
}
}
impl AutoWait {
setters! {
base: f32;
per_char: f32;
max: f32;
after_voice: f32;
}
}
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub struct Blip {
pub id: String,
pub every: usize,
pub min_interval: f32,
}
impl Default for Blip {
fn default() -> Self {
Self {
id: "blip".to_string(),
every: 2,
min_interval: 0.05,
}
}
}
impl Blip {
setters! {
every: usize;
min_interval: f32;
}
#[must_use]
pub fn id(mut self, value: impl Into<String>) -> Self {
self.id = value.into();
self
}
}
impl RevealOptions {
setters! {
chars_per_sec: f32;
comma_pause: f32;
period_pause: f32;
motion: Motion;
blip: Option<Blip>;
auto: AutoWait;
}
}
impl Default for RevealOptions {
fn default() -> Self {
Self {
chars_per_sec: 20.0,
comma_pause: 0.1,
period_pause: 0.3,
motion: Motion::Full,
blip: None,
auto: AutoWait::default(),
}
}
}