OpenShot Library | libopenshot
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
AnimatedCurve.h
Go to the documentation of this file.
1
8
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
24
namespace
openshot
{
25
26
class
AnimatedCurveNode
{
27
public
:
28
int
id
;
29
Keyframe
x
;
30
Keyframe
y
;
31
Keyframe
left_handle_x
;
32
Keyframe
left_handle_y
;
33
Keyframe
right_handle_x
;
34
Keyframe
right_handle_y
;
35
InterpolationType
interpolation
;
36
HandleType
handle_type
;
37
38
AnimatedCurveNode
();
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
49
class
AnimatedCurve
{
50
private
:
51
std::vector<AnimatedCurveNode> nodes;
52
53
public
:
54
Keyframe
enabled
;
55
56
AnimatedCurve
();
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
Json.h
Header file for JSON class.
KeyFrame.h
Header file for the Keyframe class.
Point.h
Header file for Point class.
openshot::AnimatedCurveNode::Json
std::string Json() const
Definition
AnimatedCurve.cpp:56
openshot::AnimatedCurveNode::right_handle_x
Keyframe right_handle_x
Definition
AnimatedCurve.h:33
openshot::AnimatedCurveNode::SetJsonValue
void SetJsonValue(const Json::Value &root)
Definition
AnimatedCurve.cpp:82
openshot::AnimatedCurveNode::AnimatedCurveNode
AnimatedCurveNode()
Definition
AnimatedCurve.cpp:30
openshot::AnimatedCurveNode::x
Keyframe x
Definition
AnimatedCurve.h:29
openshot::AnimatedCurveNode::right_handle_y
Keyframe right_handle_y
Definition
AnimatedCurve.h:34
openshot::AnimatedCurveNode::JsonValue
Json::Value JsonValue() const
Definition
AnimatedCurve.cpp:60
openshot::AnimatedCurveNode::Evaluate
Point Evaluate(int64_t frame_number, double x_scale=1.0) const
Definition
AnimatedCurve.cpp:44
openshot::AnimatedCurveNode::y
Keyframe y
Definition
AnimatedCurve.h:30
openshot::AnimatedCurveNode::interpolation
InterpolationType interpolation
Definition
AnimatedCurve.h:35
openshot::AnimatedCurveNode::SetJson
void SetJson(const std::string value)
Definition
AnimatedCurve.cpp:74
openshot::AnimatedCurveNode::id
int id
Definition
AnimatedCurve.h:28
openshot::AnimatedCurveNode::handle_type
HandleType handle_type
Definition
AnimatedCurve.h:36
openshot::AnimatedCurveNode::left_handle_x
Keyframe left_handle_x
Definition
AnimatedCurve.h:31
openshot::AnimatedCurveNode::left_handle_y
Keyframe left_handle_y
Definition
AnimatedCurve.h:32
openshot::AnimatedCurve::SetJsonValue
void SetJsonValue(const Json::Value &root)
Definition
AnimatedCurve.cpp:165
openshot::AnimatedCurve::SetJson
void SetJson(const std::string value)
Definition
AnimatedCurve.cpp:157
openshot::AnimatedCurve::AnimatedCurve
AnimatedCurve()
Definition
AnimatedCurve.cpp:103
openshot::AnimatedCurve::enabled
Keyframe enabled
Definition
AnimatedCurve.h:54
openshot::AnimatedCurve::Nodes
std::vector< AnimatedCurveNode > & Nodes()
Definition
AnimatedCurve.h:59
openshot::AnimatedCurve::Sample
float Sample(float input, int64_t frame_number) const
Definition
AnimatedCurve.cpp:128
openshot::AnimatedCurve::Summary
std::string Summary(int64_t frame_number) const
Definition
AnimatedCurve.cpp:136
openshot::AnimatedCurve::Json
std::string Json() const
Definition
AnimatedCurve.cpp:144
openshot::AnimatedCurve::Nodes
const std::vector< AnimatedCurveNode > & Nodes() const
Definition
AnimatedCurve.h:58
openshot::AnimatedCurve::BuildCurve
Keyframe BuildCurve(int64_t frame_number, double x_scale=1.0) const
Definition
AnimatedCurve.cpp:109
openshot::AnimatedCurve::JsonValue
Json::Value JsonValue() const
Definition
AnimatedCurve.cpp:148
openshot::Keyframe
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition
KeyFrame.h:53
openshot::Point
A Point is the basic building block of a key-frame curve.
Definition
Point.h:64
openshot
This namespace is the default namespace for all code in the openshot library.
Definition
AnimatedCurve.h:24
openshot::HandleType
HandleType
When BEZIER interpolation is used, the point's left and right handles are used to influence the direc...
Definition
Point.h:41
openshot::InterpolationType
InterpolationType
This controls how a Keyframe uses this point to interpolate between two points.
Definition
Point.h:28
openshot::LINEAR
@ LINEAR
Linear curves are angular, straight lines between two points.
Definition
Point.h:30
AnimatedCurve.h
Generated by
1.17.0