|
OpenShot Library | libopenshot 0.5.0
|
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 (double x, double y, InterpolationType interpolate=BEZIER) |
| Add a new point on the key-frame, with optional interpolation type. | |
| 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. | |
| bool | Contains (Point p) const |
| Does this keyframe contain a specific point. | |
| int64_t | FindIndex (Point p) const |
| Get the index of a point by matching a coordinate. | |
| void | FlipPoints () |
| Flip all the points in this openshot::Keyframe (useful for reversing an effect or transition, etc...). | |
| Point | GetClosestPoint (Point p) const |
| Get current point (or closest point to the right) from the X coordinate (i.e. the frame number). | |
| Point | GetClosestPoint (Point p, bool useLeft) const |
| int64_t | GetCount () const |
| Get the number of points (i.e. # of points). | |
| double | GetDelta (int64_t index) const |
| Get the change in Y value (from the previous Y value). | |
| int | GetInt (int64_t index) const |
| Get the rounded INT value at a specific index. | |
| int64_t | GetLength () const |
| int64_t | GetLong (int64_t index) const |
| Get the rounded LONG value at a specific index. | |
| Point | GetMaxPoint () const |
| Get max point (by Y coordinate). | |
| Point const & | GetPoint (int64_t index) const |
| Get a point at a specific index. | |
| Point | GetPreviousPoint (Point p) const |
| Get previous point (. | |
| double | GetValue (int64_t index) const |
| Get the value at a specific index. | |
| bool | IsIncreasing (int index) const |
| Get the direction of the curve at a specific index (increasing or decreasing). | |
| std::string | Json () const |
| Generate JSON string of this object. | |
| Json::Value | JsonValue () const |
| Generate Json::Value for this object. | |
| Keyframe ()=default | |
| Default constructor for the Keyframe class. | |
| Keyframe (const std::vector< openshot::Point > &points) | |
| Constructor which adds a supplied vector of Points. | |
| Keyframe (double value) | |
| Constructor which sets the default point & coordinate at X=1. | |
| void | PrintPoints (std::ostream *out=&std::cout) const |
| Print a list of points. | |
| void | PrintValues (std::ostream *out=&std::cout) const |
| Print just the Y value of the point's primary coordinate. | |
| void | RemovePoint (int64_t index) |
| Remove a point by index. | |
| void | RemovePoint (Point p) |
| Remove a point by matching a coordinate. | |
| void | ScalePoints (double scale) |
| void | SetJson (const std::string value) |
| Load JSON string into this object. | |
| void | SetJsonValue (const Json::Value root) |
| Load Json::Value into this object. | |
| void | UpdatePoint (int64_t index, Point p) |
| Replace an existing point with a new point. | |
| ~Keyframe () | |
| Destructor. | |
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 53 of file KeyFrame.h.
|
default |
Default constructor for the Keyframe class.
| Keyframe::Keyframe | ( | double | value | ) |
Constructor which sets the default point & coordinate at X=1.
Definition at line 115 of file KeyFrame.cpp.
| Keyframe::Keyframe | ( | const std::vector< openshot::Point > & | points | ) |
Constructor which adds a supplied vector of Points.
Definition at line 121 of file KeyFrame.cpp.
| Keyframe::~Keyframe | ( | ) |
Destructor.
Definition at line 124 of file KeyFrame.cpp.
| void Keyframe::AddPoint | ( | double | x, |
| double | y, | ||
| InterpolationType | interpolate = BEZIER ) |
Add a new point on the key-frame, with optional interpolation type.
Definition at line 156 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 131 of file KeyFrame.cpp.
Referenced by AddPoint(), Keyframe(), SetJsonValue(), and UpdatePoint().
| bool Keyframe::Contains | ( | Point | p | ) | const |
Does this keyframe contain a specific point.
Definition at line 184 of file KeyFrame.cpp.
Referenced by openshot::ClipBase::add_property_json(), openshot::TrackedObjectBBox::add_property_json(), and PrintValues().
| int64_t Keyframe::FindIndex | ( | Point | p | ) | const |
Get the index of a point by matching a coordinate.
Definition at line 166 of file KeyFrame.cpp.
Referenced by GetPreviousPoint().
| void Keyframe::FlipPoints | ( | ) |
Flip all the points in this openshot::Keyframe (useful for reversing an effect or transition, etc...).
Definition at line 530 of file KeyFrame.cpp.
Get current point (or closest point to the right) from the X coordinate (i.e. the frame number).
Definition at line 221 of file KeyFrame.cpp.
Referenced by openshot::ClipBase::add_property_json(), openshot::TrackedObjectBBox::add_property_json(), and GetClosestPoint().
Get current point (or closest point) from the X coordinate (i.e. the frame number) Either use the closest left point, or right point
Definition at line 191 of file KeyFrame.cpp.
| int64_t Keyframe::GetCount | ( | ) | const |
Get the number of points (i.e. # of points).
Definition at line 424 of file KeyFrame.cpp.
Referenced by openshot::ClipBase::add_property_json(), openshot::TrackedObjectBBox::add_property_json(), and openshot::AudioWaveformer::ApplyKeyframes().
| double Keyframe::GetDelta | ( | int64_t | index | ) | const |
Get the change in Y value (from the previous Y value).
Definition at line 399 of file KeyFrame.cpp.
Referenced by PrintValues().
| int Keyframe::GetInt | ( | int64_t | index | ) | const |
Get the rounded INT value at a specific index.
Definition at line 282 of file KeyFrame.cpp.
| int64_t Keyframe::GetLength | ( | ) | const |
Definition at line 417 of file KeyFrame.cpp.
Referenced by openshot::AudioWaveformer::ApplyKeyframes(), GetDelta(), IsIncreasing(), and PrintValues().
| int64_t Keyframe::GetLong | ( | int64_t | index | ) | const |
Get the rounded LONG value at a specific index.
Definition at line 287 of file KeyFrame.cpp.
| Point Keyframe::GetMaxPoint | ( | ) | const |
Get max point (by Y coordinate).
Definition at line 245 of file KeyFrame.cpp.
Referenced by openshot::ApplyCropResizeScale().
| Point const & Keyframe::GetPoint | ( | int64_t | index | ) | const |
Get a point at a specific index.
Definition at line 407 of file KeyFrame.cpp.
Get previous point (.
Definition at line 226 of file KeyFrame.cpp.
Referenced by openshot::ClipBase::add_property_json(), and openshot::TrackedObjectBBox::add_property_json().
| double Keyframe::GetValue | ( | int64_t | index | ) | const |
Get the value at a specific index.
Definition at line 258 of file KeyFrame.cpp.
Referenced by openshot::AudioWaveformer::ApplyKeyframes(), GetDelta(), GetInt(), GetLong(), IsIncreasing(), and PrintValues().
| bool Keyframe::IsIncreasing | ( | int | index | ) | const |
Get the direction of the curve at a specific index (increasing or decreasing).
Definition at line 292 of file KeyFrame.cpp.
Referenced by PrintValues().
| std::string Keyframe::Json | ( | ) | const |
Generate JSON string of this object.
Definition at line 332 of file KeyFrame.cpp.
| Json::Value Keyframe::JsonValue | ( | ) | const |
Generate Json::Value for this object.
Definition at line 339 of file KeyFrame.cpp.
Referenced by Json().
| void Keyframe::PrintPoints | ( | std::ostream * | out = &std::cout | ) | const |
Print a list of points.
Definition at line 470 of file KeyFrame.cpp.
| void Keyframe::PrintValues | ( | std::ostream * | out = &std::cout | ) | const |
Print just the Y value of the point's primary coordinate.
Definition at line 481 of file KeyFrame.cpp.
| void Keyframe::RemovePoint | ( | int64_t | index | ) |
Remove a point by index.
Definition at line 449 of file KeyFrame.cpp.
| void Keyframe::RemovePoint | ( | Point | p | ) |
Remove a point by matching a coordinate.
Definition at line 430 of file KeyFrame.cpp.
Referenced by UpdatePoint().
| void Keyframe::ScalePoints | ( | double | 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 516 of file KeyFrame.cpp.
| void Keyframe::SetJson | ( | const std::string | value | ) |
Load JSON string into this object.
Definition at line 355 of file KeyFrame.cpp.
| void Keyframe::SetJsonValue | ( | const Json::Value | root | ) |
Load Json::Value into this object.
Definition at line 372 of file KeyFrame.cpp.
Referenced by SetJson().
| void Keyframe::UpdatePoint | ( | int64_t | index, |
| Point | p ) |
Replace an existing point with a new point.
Definition at line 462 of file KeyFrame.cpp.