Crates.io | anim_curve |
lib.rs | anim_curve |
version | 0.3.0 |
source | src |
created_at | 2024-09-21 09:19:31.767238 |
updated_at | 2024-09-21 09:55:36.903338 |
description | Curve Calculation function library with simple dependencies. |
homepage | |
repository | https://github.com/bp0002/anim_curve.git |
max_upload_size | |
id | 1382064 |
size | 70,472 |
Rust value animation curve
动画曲线包含
曲线进度数据类型可选 f32
或 f64
, 默认为 f32
曲线类型
let curve = FrameCurve::curve_easing(0.0, 1.0, frame_count as FrameIndex, frame_count, EEasingMode::None);
let mut curve = FrameCurve::curve_frame_values(60);
FrameCurve::curve_frame_values_frame(&mut curve, 0, 0.0);
FrameCurve::curve_frame_values_frame(&mut curve, 15 as FrameIndex, 1.0);
FrameCurve::curve_frame_values_frame(&mut curve, 30 as FrameIndex, 3.0);
FrameCurve::curve_frame_values_frame(&mut curve, 60 as FrameIndex, 4.0);
// 创建步进进度计算器
let amountcalc = AnimationAmountCalc::from_steps(1, EStepMode::JumpStart);
let val = curve.interple(i as KeyFrameCurveValue / 60., &amountcalc);
let mut curve = FrameCurve::curve_minmax_curve(0.0, 1.0, 60);
FrameCurve::curve_minmax_curve_frame(&mut curve, 0, 0.0, 2.0, 2.0);
FrameCurve::curve_minmax_curve_frame(&mut curve, (frame_count/2) as FrameIndex, 0.5, 0.0, 0.0);
FrameCurve::curve_minmax_curve_frame(&mut curve, frame_count as FrameIndex, 1.0, 2.0, 2.0);