OpenShot Library | libopenshot 1.1.1
AnimatedCurve.h
Go to the documentation of this file.
1
9// Copyright (c) 2008-2026 OpenShot Studios, LLC
10//
11// SPDX-License-Identifier: LGPL-3.0-or-later
12
13#ifndef OPENSHOT_ANIMATED_CURVE_H
14#define OPENSHOT_ANIMATED_CURVE_H
15
16#include "Json.h"
17#include "KeyFrame.h"
18#include "Point.h"
19
20#include <cstdint>
21#include <string>
22#include <vector>
23
24namespace openshot {
25
27public:
28 int id;
37
39 AnimatedCurveNode(int node_id, double node_x, double node_y, InterpolationType node_interpolation=LINEAR);
40
41 Point Evaluate(int64_t frame_number, double x_scale=1.0) const;
42
43 std::string Json() const;
44 Json::Value JsonValue() const;
45 void SetJson(const std::string value);
46 void SetJsonValue(const Json::Value& root);
47};
48
50private:
51 std::vector<AnimatedCurveNode> nodes;
52
53public:
55
57
58 const std::vector<AnimatedCurveNode>& Nodes() const { return nodes; }
59 std::vector<AnimatedCurveNode>& Nodes() { return nodes; }
60
61 Keyframe BuildCurve(int64_t frame_number, double x_scale=1.0) const;
62 float Sample(float input, int64_t frame_number) const;
63 std::string Summary(int64_t frame_number) const;
64
65 std::string Json() const;
66 Json::Value JsonValue() const;
67 void SetJson(const std::string value);
68 void SetJsonValue(const Json::Value& root);
69};
70
71}
72
73#endif
Header file for JSON class.
Header file for the Keyframe class.
Header file for Point class.
std::string Json() const
void SetJsonValue(const Json::Value &root)
Json::Value JsonValue() const
Point Evaluate(int64_t frame_number, double x_scale=1.0) const
InterpolationType interpolation
Definition: AnimatedCurve.h:35
void SetJson(const std::string value)
void SetJsonValue(const Json::Value &root)
void SetJson(const std::string value)
std::vector< AnimatedCurveNode > & Nodes()
Definition: AnimatedCurve.h:59
float Sample(float input, int64_t frame_number) const
std::string Summary(int64_t frame_number) const
std::string Json() const
const std::vector< AnimatedCurveNode > & Nodes() const
Definition: AnimatedCurve.h:58
Keyframe BuildCurve(int64_t frame_number, double x_scale=1.0) const
Json::Value JsonValue() const
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition: KeyFrame.h:53
A Point is the basic building block of a key-frame curve.
Definition: Point.h:64
This namespace is the default namespace for all code in the openshot library.
Definition: AnimatedCurve.h:24
HandleType
When BEZIER interpolation is used, the point's left and right handles are used to influence the direc...
Definition: Point.h:41
InterpolationType
This controls how a Keyframe uses this point to interpolate between two points.
Definition: Point.h:28
@ LINEAR
Linear curves are angular, straight lines between two points.
Definition: Point.h:30