friz
An animation control system for JUCE
|
Sine/Cosine wave generator. More...
#include <sinusoid.h>
Public Member Functions | |
Sinusoid (float startPhase_, float endPhase_, int duration) | |
Sinusoid (int startQuad, int endQuad, int duration) | |
Public Member Functions inherited from friz::TimedValue | |
TimedValue (float startVal, float endVal, int duration_) | |
float | getNextValue (int msElapsed, int) override |
bool | isFinished () override |
Public Member Functions inherited from friz::AnimatedValue | |
AnimatedValue (float startVal_, float endVal_) | |
Base class init for the animated value classes. | |
virtual float | getNextValue (int msElapsed, int msSinceLastUpdate)=0 |
float | getEndValue () const |
get the ending state of this value object. When we cancel an in-progress animation, we may need to snap to the end value, and this gives a way to get there immediately. | |
virtual bool | isFinished ()=0 |
virtual bool | updateTarget (float) |
Attempt to change the end value of an animation that's currently in process. | |
void | cancel (bool moveToEndPosition) |
Cancel an in-progress animation. | |
Private Member Functions | |
float | generateNextValue (float progress) override |
Calculate the next phase value, then return its sine as the actual curve value. | |
Private Attributes | |
float | startPhase |
initial phase of the sinusoid. | |
float | endPhase |
ending phase of the sinusoid | |
Additional Inherited Members | |
Protected Member Functions inherited from friz::TimedValue | |
float | scale (float curvePoint) |
Given a fractional curve point (typically) in the range (0.f..1.f), interpolate this point between this value's start and end points. | |
Protected Attributes inherited from friz::TimedValue | |
int | duration |
duration of the event in ms. | |
Protected Attributes inherited from friz::AnimatedValue | |
float | startVal |
float | endVal |
float | currentVal |
bool | canceled { false } |
bool | finished { false } |
Sine/Cosine wave generator.
Note that this object always generates values in the natural range of a sinusoid, -1 .. +1. Your code will need to perform whatever scaling or offsets required for things to make sense in your use case.
|
inline |
A value object that can output sinusoid values. Note that we place very few constraints here for folks who like to work the corner conditions.
startPhase | start phase, typically 0..2pi |
endPhase | end phase, typically 0..2pi. |
duration | duration in milliseconds. |
|
inline |
Simpler interface to create Sinusoid objects – specify start and end positions in terms of integer multiples of pi/2. To create a full sine wave, specify start = 0 end = 4; for a full cosine wave use start = 1, end = 5.
startQuad | starting quadrant |
endQuad | ending quadrant |
duration | duration in frames. |
|
inlineoverrideprivatevirtual |
Calculate the next phase value, then return its sine as the actual curve value.
progress |
Implements friz::TimedValue.