MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / GetValue

Method GetValue

src/KeyFrame.cpp:258–279  ·  view source on GitHub ↗

Get the value at a specific index

Source from the content-addressed store, hash-verified

256
257// Get the value at a specific index
258double Keyframe::GetValue(int64_t index) const {
259 if (Points.empty()) {
260 return 0;
261 }
262 std::vector<Point>::const_iterator candidate =
263 std::lower_bound(begin(Points), end(Points), static_cast<double>(index), IsPointBeforeX);
264
265 if (candidate == end(Points)) {
266 // index is behind last point
267 return Points.back().co.Y;
268 }
269 if (candidate == begin(Points)) {
270 // index is at or before first point
271 return Points.front().co.Y;
272 }
273 if (candidate->co.X == index) {
274 // index is directly on a point
275 return candidate->co.Y;
276 }
277 std::vector<Point>::const_iterator predecessor = candidate - 1;
278 return InterpolateBetween(*predecessor, *candidate, index, 0.01);
279}
280
281// Get the rounded INT value at a specific index
282int Keyframe::GetInt(int64_t index) const {

Callers 15

PropertiesJSONMethod · 0.80
apply_keyframesMethod · 0.80
get_transformMethod · 0.80
GetBoxMethod · 0.80
PropertiesJSONMethod · 0.80
GetBoxValuesMethod · 0.80
ApplyKeyframesMethod · 0.80
add_layerMethod · 0.80
GetFrameMethod · 0.80
GetFrameMethod · 0.80
PropertiesJSONMethod · 0.80
GetFrameMethod · 0.80

Calls 1

InterpolateBetweenFunction · 0.85

Tested by

no test coverage detected