-
Notifications
You must be signed in to change notification settings - Fork 261
/
KeyFrameBase.h
85 lines (70 loc) · 2.98 KB
/
KeyFrameBase.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* @file
* @brief Header file for the KeyframeBase class
* @author Jonathan Thomas <jonathan@openshot.org>
*
* @ref License
*/
/* LICENSE
*
* Copyright (c) 2008-2019 OpenShot Studios, LLC
* <http://www.openshotstudios.com/>. This file is part of
* OpenShot Library (libopenshot), an open-source project dedicated to
* delivering high quality video editing and animation solutions to the
* world. For more information visit <http://www.openshot.org/>.
*
* OpenShot Library (libopenshot) is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* OpenShot Library (libopenshot) is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPENSHOT_KEYFRAMEBASE_H
#define OPENSHOT_KEYFRAMEBASE_H
#include <iostream>
#include <iomanip>
#include <cmath>
#include <assert.h>
#include <vector>
#include <string>
#include "Exceptions.h"
#include "Fraction.h"
#include "Coordinate.h"
#include "Point.h"
#include "Json.h"
namespace openshot {
/// Check if the X coordinate of a given Point is lower than a given value
bool IsPointBeforeX(Point const & p, double const x);
/// Linear interpolation between two points
double InterpolateLinearCurve(Point const & left, Point const & right, double const target);
/// Bezier interpolation between two points
double InterpolateBezierCurve(Point const & left, Point const & right, double const target, double const allowed_error);
/// Interpolate two points using the right Point's interpolation method
double InterpolateBetween(Point const & left, Point const & right, double target, double allowed_error);
/**
* @brief This abstract class is the base class of all Keyframes.
*
* 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.
*/
class KeyframeBase{
public:
/// Blank constructor
KeyframeBase();
/// Scale all points by a percentage (good for evenly lengthening or shortening an openshot::Keyframe)
/// 1.0 = same size, 1.05 = 5% increase, etc...
virtual void ScalePoints(double scale) { return; };
};
} // Namespace openshot
#endif