40 co(co), interpolation(interpolation), handle_type(handle_type) {
96 catch (
const std::exception& e)
99 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
106 if (!root[
"co"].isNull())
108 if (!root[
"handle_left"].isNull())
110 if (!root[
"handle_right"].isNull())
112 if (!root[
"interpolation"].isNull())
114 if (!root[
"handle_type"].isNull())
Header file for all Exception classes.
Header file for Point class.
A Cartesian coordinate (X, Y) used in the Keyframe animation system.
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
Json::Value JsonValue() const
Generate Json::Value for this object.
Exception for invalid JSON.
A Point is the basic building block of a key-frame curve.
Coordinate handle_left
This is the left handle coordinate (in percentages from 0 to 1)
void SetJson(const std::string value)
Load JSON string into this object.
Json::Value JsonValue() const
Generate Json::Value for this object.
void Initialize_RightHandle(float x, float y)
Set the right handle to a percent of the primary coordinate (0 to 1)
void Initialize_LeftHandle(float x, float y)
Set the left handle to a percent of the primary coordinate (0 to 1)
void Initialize_Handles()
HandleType handle_type
This is the handle mode.
Coordinate co
This is the primary coordinate.
InterpolationType interpolation
This is the interpolation mode.
Coordinate handle_right
This is the right handle coordinate (in percentages from 0 to 1)
Point()
Default constructor (defaults to 1,0)
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
std::string Json() const
Generate JSON string of this object.
This namespace is the default namespace for all code in the openshot library.
HandleType
When BEZIER interpolation is used, the point's left and right handles are used to influence the direc...
@ AUTO
Automatically adjust the handles to achieve the smoothest curve.
const Json::Value stringToJson(const std::string value)
InterpolationType
This controls how a Keyframe uses this point to interpolate between two points.
@ CONSTANT
Constant curves jump from their previous position to a new one (with no interpolation).
@ BEZIER
Bezier curves are quadratic curves, which create a smooth curve.