1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//! ## The Linear Interpolation.
// --- START of derived from `interpolation`.
// origin: MIT https://github.com/PistonDevelopers/interpolation/blob/master/src/lerp.rs
//
// Copyright (c) 2015 PistonDevelopers, invisageable
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// This implementation is there because I saw a lot librairies using in and the
// performance of this `interpolation`.
/// ### The Linear Interpolation.
///
/// Interpolates linearly a value between two floats with a linear easing.
/// Useful to tweak a value from point A to point B. The progress value can be
/// whatever you want — time, percentage, etc. in a range of `[0,1]`.
///
/// #### params.
///
/// | | |
/// |:----|:---------------------------|
/// | `p` | The progress. |
/// | `a` | The `start` initial value. |
/// | `b` | The `end` final value. |
///
/// #### returns.
///
/// `f32` — The interpolated result between the two float values.
///
/// #### examples.
///
/// ```
/// use eazing::interpolation::lerp::lerp;
///
/// let start = 2.0;
/// let end = 8.0;
/// let p = lerp(0.1, start, end);
///
/// assert_eq!(p, 2.6);
/// ```
/// Describes a type that can linearly interpolate between two points.
/// Implementation of `Lerp` for floats.
impl_lerp_for_float!;
/// Transitive impl of `Lerp` for arrays, given a length and index list
impl_lerp_for_array!;
impl_lerp_for_array!;
impl_lerp_for_array!;
impl_lerp_for_array!;
impl_lerp_for_array!;
// --- END of derived from `interpolation`.