Skip to content

Commit

Permalink
Fix for example apps
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon_withrow committed Aug 3, 2017
1 parent cf001de commit 820b788
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Example/Example for lottie-macos/LAMainView.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ - (void)_openAnimationFile:(NSString *)file {
self.lottieLogo = nil;

self.lottieLogo = [LOTAnimationView animationWithFilePath:file];
self.lottieLogo.contentMode = LOTViewContentModeScaleAspectFill;
self.lottieLogo.contentMode = LOTViewContentModeScaleAspectFit;
self.lottieLogo.frame = self.bounds;
self.lottieLogo.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;

[self addSubview:self.lottieLogo];
[self addSubview:self.lottieLogo positioned:NSWindowBelow relativeTo:nil];
[self.lottieLogo play];
}

Expand Down
1 change: 0 additions & 1 deletion Example/lottie-ios/AnimationExplorerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ - (void)_loadAnimationNamed:(NSString *)named {
self.laAnimation = [LOTAnimationView animationNamed:named];
self.laAnimation.contentMode = UIViewContentModeScaleAspectFit;
[self.view addSubview:self.laAnimation];
[self.laAnimation setProgressWithFrame:@16];
[self.view setNeedsLayout];
}

Expand Down
3 changes: 3 additions & 0 deletions lottie-ios/Classes/Private/LOTAnimationView.m
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ - (void)playFromFrame:(nonnull NSNumber *)fromStartFrame
if (_isAnimationPlaying) {
return;
}
if (_animationProgress == 1) {
self.animationProgress = 0;
}
NSTimeInterval offset = MAX(0, (_animationProgress * (_sceneModel.endFrame.floatValue - _sceneModel.startFrame.floatValue)) - fromStartFrame.floatValue) / _sceneModel.framerate.floatValue;
NSTimeInterval duration = ((toEndFrame.floatValue - fromStartFrame.floatValue) / _sceneModel.framerate.floatValue);
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"currentFrame"];
Expand Down

0 comments on commit 820b788

Please sign in to comment.