pub mod accumulator;
pub mod critical;
pub mod spring;
pub mod tween;
use lgwks_std::id::Uuid;
pub use accumulator::{AccumulatorComponent, AccumulatorKind, AccumulatorState, AccumulatorStore};
pub use tween::TweenComponent;
pub type NodeHandle = Uuid;
#[derive(Clone, Debug, PartialEq)]
pub struct BindingTarget {
handle: String,
property: String,
}
impl BindingTarget {
#[must_use]
pub fn new(handle: String, property: String) -> Self {
Self { handle, property }
}
#[must_use]
pub fn handle(&self) -> &str {
&self.handle
}
#[must_use]
pub fn property(&self) -> &str {
&self.property
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum NodeKind {
Tween(TweenComponent),
Accumulator(AccumulatorComponent),
}
#[derive(Clone, Debug, PartialEq)]
pub struct MotionNode {
node_id: NodeHandle,
target: BindingTarget,
kind: NodeKind,
}
impl MotionNode {
#[must_use]
pub fn new(node_id: NodeHandle, target: BindingTarget, kind: NodeKind) -> Self {
Self {
node_id,
target,
kind,
}
}
#[must_use]
pub const fn node_id(&self) -> NodeHandle {
self.node_id
}
#[must_use]
pub const fn target(&self) -> &BindingTarget {
&self.target
}
#[must_use]
pub const fn kind(&self) -> &NodeKind {
&self.kind
}
pub fn set_kind(&mut self, kind: NodeKind) {
self.kind = kind;
}
}