File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ function playClip(element, framesPerSecond) {
139
139
playClipData = {
140
140
intervalId : undefined ,
141
141
framesPerSecond : 30 ,
142
- lastFrameTimeStamp : undefined ,
142
+ lastFrameTimeStamp : new Date ( ) . getTime ( ) ,
143
143
frameRate : 0 ,
144
144
frameTimeVector : undefined ,
145
145
ignoreFrameTimeVector : false ,
@@ -182,15 +182,19 @@ function playClip(element, framesPerSecond) {
182
182
startLoadingHandler ,
183
183
endLoadingHandler ,
184
184
errorLoadingHandler ,
185
+ newlastFrameTimeStamp = new Date ( ) . getTime ( ) ,
186
+ deltatime = newlastFrameTimeStamp - playClipData . lastFrameTimeStamp ,
187
+ frames = Math . round ( ( playClipData . framesPerSecond / 1000 ) * deltatime ) ,
185
188
newImageIdIndex = stackData . currentImageIdIndex ;
186
189
187
190
const imageCount = stackData . imageIds . length ;
188
191
189
192
if ( playClipData . reverse ) {
190
- newImageIdIndex -- ;
193
+ newImageIdIndex -= frames ;
191
194
} else {
192
- newImageIdIndex ++ ;
195
+ newImageIdIndex += frames ;
193
196
}
197
+ playClipData . lastFrameTimeStamp = newlastFrameTimeStamp ;
194
198
195
199
if (
196
200
! playClipData . loop &&
You can’t perform that action at this time.
0 commit comments