run rustfmt
This commit is contained in:
@@ -3,9 +3,12 @@ extern crate splines;
|
||||
use splines::{Interpolation, Key, Spline};
|
||||
|
||||
fn main() {
|
||||
let keys = vec![Key::new(0., 0., Interpolation::default()), Key::new(5., 1., Interpolation::default())];
|
||||
let spline = Spline::from_vec(keys);
|
||||
let keys = vec![
|
||||
Key::new(0., 0., Interpolation::default()),
|
||||
Key::new(5., 1., Interpolation::default()),
|
||||
];
|
||||
let spline = Spline::from_vec(keys);
|
||||
|
||||
println!("value at 0: {:?}", spline.clamped_sample(0.));
|
||||
println!("value at 3: {:?}", spline.clamped_sample(3.));
|
||||
println!("value at 0: {:?}", spline.clamped_sample(0.));
|
||||
println!("value at 3: {:?}", spline.clamped_sample(3.));
|
||||
}
|
||||
|
@@ -1,30 +1,31 @@
|
||||
#[macro_use] extern crate serde_json;
|
||||
#[macro_use]
|
||||
extern crate serde_json;
|
||||
extern crate splines;
|
||||
|
||||
use serde_json::from_value;
|
||||
use splines::Spline;
|
||||
|
||||
fn main() {
|
||||
let value = json!{
|
||||
[
|
||||
{
|
||||
"t": 0,
|
||||
"interpolation": "linear",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"t": 1,
|
||||
"interpolation": { "step": 0.5 },
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"t": 5,
|
||||
"interpolation": "cosine",
|
||||
"value": 10
|
||||
},
|
||||
]
|
||||
};
|
||||
let value = json! {
|
||||
[
|
||||
{
|
||||
"t": 0,
|
||||
"interpolation": "linear",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"t": 1,
|
||||
"interpolation": { "step": 0.5 },
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"t": 5,
|
||||
"interpolation": "cosine",
|
||||
"value": 10
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
let spline = from_value::<Spline<f32, f32>>(value);
|
||||
println!("{:?}", spline);
|
||||
let spline = from_value::<Spline<f32, f32>>(value);
|
||||
println!("{:?}", spline);
|
||||
}
|
||||
|
Reference in New Issue
Block a user