1#![deny(missing_docs)]
8#![deny(missing_debug_implementations)]
9
10mod batch;
11mod color;
12mod driver;
13mod easing;
14mod error;
15mod keyframe;
16mod path;
17mod physics;
18mod spring;
19mod timeline;
20mod tween;
21mod types;
22mod wasm_dom;
23
24pub use batch::TweenBatch;
25pub use color::{ColorTween, interpolate_color};
26pub use driver::{RafDriver, ScrollDriver};
27pub use easing::{available_easings, ease, parse_easing_for_js};
28pub use keyframe::{KeyframeTrack, KeyframeTrack2D, KeyframeTrack3D, KeyframeTrack4D};
29pub use path::{MorphPath, MotionPath};
30pub use physics::{DragState, GestureRecognizer, Inertia, Inertia2D};
31pub use spring::{Spring, Spring2D, Spring3D, Spring4D};
32pub use tween::{Tween, Tween2D, Tween3D, Tween4D};
33pub use wasm_dom::{Draggable, FlipAnimation, LayoutAnimator, Observer, ScrollSmoother, SplitText};
34
35use wasm_bindgen::prelude::*;
36
37#[wasm_bindgen(js_name = initAnimato)]
43pub fn init_animato() {
44 #[cfg(all(target_arch = "wasm32", feature = "panic-hook"))]
45 console_error_panic_hook::set_once();
46}
47
48#[wasm_bindgen]
50pub fn version() -> String {
51 env!("CARGO_PKG_VERSION").to_owned()
52}
53
54#[wasm_bindgen(js_name = snapTo)]
56pub fn snap_to(value: f32, grid: f32) -> f32 {
57 animato_tween::snap_to(value, grid)
58}
59
60#[wasm_bindgen(js_name = roundTo)]
62pub fn round_to(value: f32, decimals: u32) -> f32 {
63 animato_tween::round_to(value, decimals)
64}