31 #include "../include/Point.h" 37 Point::Point() : interpolation(
BEZIER), handle_type(
AUTO)
88 co(co), interpolation(interpolation), handle_type(handle_type) {
139 Json::CharReaderBuilder rbuilder;
140 Json::CharReader* reader(rbuilder.newCharReader());
143 bool success = reader->parse( value.c_str(),
144 value.c_str() + value.size(), &root, &errors );
149 throw InvalidJSON(
"JSON could not be parsed (or is invalid)");
156 catch (
const std::exception& e)
159 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
166 if (!root[
"co"].isNull())
168 if (!root[
"handle_left"].isNull())
170 if (!root[
"handle_right"].isNull())
172 if (!root[
"interpolation"].isNull())
174 if (!root[
"handle_type"].isNull())
void Initialize_LeftHandle(float x, float y)
Set the left handle to a percent of the primary coordinate (0 to 1)
Json::Value JsonValue()
Generate Json::JsonValue for this object.
This class represents a Cartesian coordinate (X, Y) used in the Keyframe animation system...
void SetJsonValue(Json::Value root)
Load Json::JsonValue into this object.
Bezier curves are quadratic curves, which create a smooth curve.
void SetJson(std::string value)
Load JSON string into this object.
InterpolationType interpolation
This is the interpolation mode.
Coordinate handle_right
This is the right handle coordinate (in percentages from 0 to 1)
void Initialize_RightHandle(float x, float y)
Set the right handle to a percent of the primary coordinate (0 to 1)
Coordinate handle_left
This is the left handle coordinate (in percentages from 0 to 1)
HandleType handle_type
This is the handle mode.
std::string Json()
Get and Set JSON methods.
HandleType
When BEZIER interpolation is used, the point's left and right handles are used to influence the direc...
Point()
Default constructor (defaults to 1,0)
Automatically adjust the handles to achieve the smoothest curve.
InterpolationType
This controls how a Keyframe uses this point to interpolate between two points.
This namespace is the default namespace for all code in the openshot library.
Coordinate co
This is the primary coordinate.
Exception for invalid JSON.
void SetJsonValue(Json::Value root)
Load Json::JsonValue into this object.
void Initialize_Handles()
Json::Value JsonValue()
Generate Json::JsonValue for this object.
Constant curves jump from their previous position to a new one (with no interpolation).