Add durationPerFrame to Frameset #507
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds
durationPerFrame
field to the existingFrameset
class. This property is necessary to calculate the correct frame depending on the timestamp. Before there was no way to crop the correct frame bounds from the storyboard ("framesPerPageX
xframesPerPageY
"-matrix).Short example with this change to calculate the correct frame coordinates (pseudo code):
-- Goal: get frame bounds for 3:25:500 (= 180.500 milliseconds)´
-- Given: storyboard-Urls in 5x5-matrix, duration per frame = 5.000, frame height = 160 and frame width = 90
=>
180.500 / 5.000
= 36.1 => 37. Frame=>
(37 - 1 * 25)
= 12 => 12. frame in 2. storyboard=>
(12 - 2 * 5)
= 2 => 3. row, 2. column => row index = 2, column index = 1=> Bounds / rectangle of the frame at the position:
left top (x, y) = (0 + 1 * 160 = 160, 0 + 2 * 90 = 180)
=>
(left, top, right, bottom) = (160, 180, 320, 270)