sync
This commit is contained in:
parent
32d2a79cf8
commit
310de419e7
|
@ -242,6 +242,18 @@
|
|||
NSUInteger currentFrameIndex = self.currentFrameIndex;
|
||||
NSUInteger nextFrameIndex = (currentFrameIndex + 1) % totalFrameCount;
|
||||
|
||||
switch (self.playbackMode) {
|
||||
case SDAnimatedImagePlaybackModeNormal:
|
||||
nextFrameIndex = (currentFrameIndex + 1) % totalFrameCount;
|
||||
break;
|
||||
case SDAnimatedImagePlaybackModeReverse: {
|
||||
nextFrameIndex = (currentFrameIndex - 1) % totalFrameCount;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Check if we need to display new frame firstly
|
||||
BOOL bufferFull = NO;
|
||||
if (self.needsDisplayWhenImageBecomesAvailable) {
|
||||
|
|
|
@ -53,6 +53,10 @@
|
|||
`< 0.0` is not supported currently and stop animation. (may support reverse playback in the future)
|
||||
*/
|
||||
@property (nonatomic, assign) double playbackRate;
|
||||
|
||||
/// The animation playback mode. Default mode is SDAnimatedImagePlaybackModeNormal.
|
||||
@property (nonatomic, assign) SDAnimatedImagePlaybackMode playbackMode;
|
||||
|
||||
/**
|
||||
Provide a max buffer size by bytes. This is used to adjust frame buffer count and can be useful when the decoding cost is expensive (such as Animated WebP software decoding). Default is 0.
|
||||
`0` means automatically adjust by calculating current memory usage.
|
||||
|
@ -89,11 +93,6 @@
|
|||
*/
|
||||
@property (nonatomic, assign) BOOL autoPlayAnimatedImage;
|
||||
|
||||
/**
|
||||
The animation player.
|
||||
*/
|
||||
@property (nonatomic, strong, readonly, nullable) SDAnimatedImagePlayer *player;
|
||||
|
||||
/**
|
||||
You can specify a runloop mode to let it rendering.
|
||||
Default is NSRunLoopCommonModes on multi-core device, NSDefaultRunLoopMode on single-core device
|
||||
|
|
|
@ -163,6 +163,9 @@
|
|||
// Play Rate
|
||||
self.player.playbackRate = self.playbackRate;
|
||||
|
||||
// Play Mode
|
||||
self.player.playbackMode = self.playbackMode;
|
||||
|
||||
// Setup handler
|
||||
@weakify(self);
|
||||
self.player.animationFrameHandler = ^(NSUInteger index, UIImage * frame) {
|
||||
|
|
Loading…
Reference in New Issue