mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
ff308488fe
# Objective This implements another item on the way to complete the `Curves` implementation initiative Citing @mweatherley > Curve adaptors for making a curve repeat or ping-pong would be useful. This adds three widely applicable adaptors: - `ReverseCurve` "plays" the curve backwards - `RepeatCurve` to repeat the curve for `n` times where `n` in `[0,inf)` - `ForeverCurve` which extends the curves domain to `EVERYWHERE` - `PingPongCurve` (name wip (?)) to chain the curve with it's reverse. This would be achievable with `ReverseCurve` and `ChainCurve`, but it would require the use of `by_ref` which can be restrictive in some scenarios where you'd rather just consume the curve. Users can still create the same effect by combination of the former two, but since this will be most likely a very typical adaptor we should also provide it on the library level. (Why it's typical: you can create a single period of common waves with it pretty easily, think square wave (= pingpong + step), triangle wave ( = pingpong + linear), etc.) - `ContinuationCurve` which chains two curves but also makes sure that the samples of the second curve are translated so that `sample(first.end) == sample(second.start)` ## Solution Implement the adaptors above. (More suggestions are welcome!) ## Testing - [x] add simple tests. One per adaptor --------- Co-authored-by: eckz <567737+eckz@users.noreply.github.com> Co-authored-by: Matty <2975848+mweatherley@users.noreply.github.com> Co-authored-by: IQuick 143 <IQuick143cz@gmail.com> Co-authored-by: Matty <weatherleymatthew@gmail.com> Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
clippy.toml | ||
README.md |