OpenShot Library | libopenshot
0.1.2
|
A Keyframe is a collection of Point instances, which is used to vary a number or property over time. More...
#include <KeyFrame.h>
Public Member Functions | |
void | AddPoint (Point p) |
Add a new point on the key-frame. Each point has a primary coordinate, a left handle, and a right handle. More... | |
void | AddPoint (float x, float y) |
Add a new point on the key-frame, with some defaults set (BEZIER, AUTO Handles, etc...) More... | |
void | AddPoint (float x, float y, InterpolationType interpolate) |
Add a new point on the key-frame, with a specific interpolation type. More... | |
bool | Contains (Point p) |
Does this keyframe contain a specific point. More... | |
long int | FindIndex (Point p) throw (OutOfBoundsPoint) |
Get the index of a point by matching a coordinate. More... | |
void | FlipPoints () |
Flip all the points in this openshot::Keyframe (useful for reversing an effect or transition, etc...) More... | |
Point | GetClosestPoint (Point p) |
Get current point (or closest point) from the X coordinate (i.e. the frame number) More... | |
long int | GetCount () |
Get the number of points (i.e. # of points) More... | |
float | GetDelta (long int index) |
Get the change in Y value (from the previous Y value) More... | |
int | GetInt (long int index) |
Get the rounded INT value at a specific index. More... | |
long int | GetLength () |
long int | GetLong (long int index) |
Get the rounded LONG value at a specific index. More... | |
Point & | GetPoint (long int index) throw (OutOfBoundsPoint) |
Get a point at a specific index. More... | |
Fraction | GetRepeatFraction (long int index) |
Get the fraction that represents how many times this value is repeated in the curve. More... | |
float | GetValue (long int index) |
Get the value at a specific index. More... | |
bool | IsIncreasing (int index) |
Get the direction of the curve at a specific index (increasing or decreasing) More... | |
string | Json () |
Get and Set JSON methods. More... | |
Json::Value | JsonValue () |
Generate Json::JsonValue for this object. More... | |
Keyframe () | |
Default constructor for the Keyframe class. More... | |
Keyframe (float value) | |
Constructor which sets the default point & coordinate at X=0. More... | |
void | PrintPoints () |
Print a list of points. More... | |
void | PrintValues () |
Print just the Y value of the point's primary coordinate. More... | |
void | Process () |
Calculate all of the values for this keyframe. More... | |
void | RemovePoint (Point p) throw (OutOfBoundsPoint) |
Remove a point by matching a coordinate. More... | |
void | RemovePoint (long int index) throw (OutOfBoundsPoint) |
Remove a point by index. More... | |
void | ScalePoints (float scale) |
void | SetHandles (Point current) |
Set the handles, used for smooth curves. The handles are based on the surrounding points. More... | |
void | SetJson (string value) throw (InvalidJSON) |
Load JSON string into this object. More... | |
void | SetJsonValue (Json::Value root) |
Load Json::JsonValue into this object. More... | |
void | UpdatePoint (long int index, Point p) |
Replace an existing point with a new point. More... | |
Public Attributes | |
float | Auto_Handle_Percentage |
Percentage the left and right handles should be adjusted to, to create a smooth curve. More... | |
vector< Point > | Points |
Vector of all Points. More... | |
vector< Coordinate > | Values |
Vector of all Values (i.e. the processed coordinates from the curve) More... | |
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Keyframes are used to animate and interpolate values of properties over time. For example, a single property can use a Keyframe instead of a constant value. Assume you want to slide an image (from left to right) over a video. You can create a Keyframe which will adjust the X value of the image over 100 frames (or however many frames the animation needs to last) from the value of 0 to 640.
Please see the following Example Code:
Definition at line 64 of file KeyFrame.h.
Keyframe::Keyframe | ( | ) |
Default constructor for the Keyframe class.
Definition at line 65 of file KeyFrame.cpp.
Keyframe::Keyframe | ( | float | value | ) |
Constructor which sets the default point & coordinate at X=0.
Definition at line 56 of file KeyFrame.cpp.
void Keyframe::AddPoint | ( | Point | p | ) |
Add a new point on the key-frame. Each point has a primary coordinate, a left handle, and a right handle.
Definition at line 72 of file KeyFrame.cpp.
void Keyframe::AddPoint | ( | float | x, |
float | y | ||
) |
Add a new point on the key-frame, with some defaults set (BEZIER, AUTO Handles, etc...)
Definition at line 93 of file KeyFrame.cpp.
void Keyframe::AddPoint | ( | float | x, |
float | y, | ||
InterpolationType | interpolate | ||
) |
Add a new point on the key-frame, with a specific interpolation type.
Definition at line 103 of file KeyFrame.cpp.
bool Keyframe::Contains | ( | Point | p | ) |
Does this keyframe contain a specific point.
Definition at line 175 of file KeyFrame.cpp.
long int Keyframe::FindIndex | ( | Point | p | ) | |
throw | ( | OutOfBoundsPoint | |||
) |
Get the index of a point by matching a coordinate.
Definition at line 157 of file KeyFrame.cpp.
void Keyframe::FlipPoints | ( | ) |
Flip all the points in this openshot::Keyframe (useful for reversing an effect or transition, etc...)
Definition at line 872 of file KeyFrame.cpp.
Get current point (or closest point) from the X coordinate (i.e. the frame number)
Definition at line 193 of file KeyFrame.cpp.
long int Keyframe::GetCount | ( | ) |
Get the number of points (i.e. # of points)
Definition at line 453 of file KeyFrame.cpp.
float Keyframe::GetDelta | ( | long int | index | ) |
Get the change in Y value (from the previous Y value)
Definition at line 411 of file KeyFrame.cpp.
int Keyframe::GetInt | ( | long int | index | ) |
Get the rounded INT value at a specific index.
Definition at line 246 of file KeyFrame.cpp.
long int Keyframe::GetLength | ( | ) |
Definition at line 443 of file KeyFrame.cpp.
long int Keyframe::GetLong | ( | long int | index | ) |
Get the rounded LONG value at a specific index.
Definition at line 268 of file KeyFrame.cpp.
Point & Keyframe::GetPoint | ( | long int | index | ) | |
throw | ( | OutOfBoundsPoint | |||
) |
Get a point at a specific index.
Definition at line 433 of file KeyFrame.cpp.
Fraction Keyframe::GetRepeatFraction | ( | long int | index | ) |
Get the fraction that represents how many times this value is repeated in the curve.
Definition at line 389 of file KeyFrame.cpp.
float Keyframe::GetValue | ( | long int | index | ) |
Get the value at a specific index.
Definition at line 224 of file KeyFrame.cpp.
bool Keyframe::IsIncreasing | ( | int | index | ) |
Get the direction of the curve at a specific index (increasing or decreasing)
Definition at line 290 of file KeyFrame.cpp.
string Keyframe::Json | ( | ) |
Get and Set JSON methods.
Generate JSON string of this object
Definition at line 312 of file KeyFrame.cpp.
Json::Value Keyframe::JsonValue | ( | ) |
Generate Json::JsonValue for this object.
Definition at line 319 of file KeyFrame.cpp.
void Keyframe::PrintPoints | ( | ) |
Print a list of points.
Definition at line 511 of file KeyFrame.cpp.
void Keyframe::PrintValues | ( | ) |
Print just the Y value of the point's primary coordinate.
Definition at line 523 of file KeyFrame.cpp.
void Keyframe::Process | ( | ) |
Calculate all of the values for this keyframe.
This clears any existing data in the "values" vector. This method is automatically called by AddPoint(), so you don't typically need to call this method.
Definition at line 537 of file KeyFrame.cpp.
void Keyframe::RemovePoint | ( | Point | p | ) | |
throw | ( | OutOfBoundsPoint | |||
) |
Remove a point by matching a coordinate.
Definition at line 460 of file KeyFrame.cpp.
void Keyframe::RemovePoint | ( | long int | index | ) | |
throw | ( | OutOfBoundsPoint | |||
) |
Remove a point by index.
Definition at line 482 of file KeyFrame.cpp.
void Keyframe::ScalePoints | ( | float | scale | ) |
Scale all points by a percentage (good for evenly lengthening or shortening an openshot::Keyframe) 1.0 = same size, 1.05 = 5% increase, etc...
Definition at line 855 of file KeyFrame.cpp.
void Keyframe::SetHandles | ( | Point | current | ) |
Set the handles, used for smooth curves. The handles are based on the surrounding points.
Definition at line 114 of file KeyFrame.cpp.
void Keyframe::SetJson | ( | string | value | ) | |
throw | ( | InvalidJSON | |||
) |
Load JSON string into this object.
Definition at line 337 of file KeyFrame.cpp.
void Keyframe::SetJsonValue | ( | Json::Value | root | ) |
Load Json::JsonValue into this object.
Definition at line 360 of file KeyFrame.cpp.
void Keyframe::UpdatePoint | ( | long int | index, |
Point | p | ||
) |
Replace an existing point with a new point.
Definition at line 497 of file KeyFrame.cpp.
float openshot::Keyframe::Auto_Handle_Percentage |
Percentage the left and right handles should be adjusted to, to create a smooth curve.
Definition at line 94 of file KeyFrame.h.
vector<Point> openshot::Keyframe::Points |
Vector of all Points.
Definition at line 92 of file KeyFrame.h.
vector<Coordinate> openshot::Keyframe::Values |
Vector of all Values (i.e. the processed coordinates from the curve)
Definition at line 93 of file KeyFrame.h.