Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

found some bugs with _fadeoutDuration #15

Closed
zpz1237 opened this issue Dec 30, 2015 · 4 comments
Closed

found some bugs with _fadeoutDuration #15

zpz1237 opened this issue Dec 30, 2015 · 4 comments

Comments

@zpz1237
Copy link

zpz1237 commented Dec 30, 2015

I have tried to change the _fadeoutDuration from 2.5s to another value, but it doesn't work
I find that you made mistake in this function,

- (void)startAnimationWithDuration:(CFTimeInterval)duration
{
  self.beginTime = CACurrentMediaTime();
  self.endTime = self.beginTime + self.shineDuration;
  self.displaylink.paused = NO;
}

Maybe you should add duration rather than self.shineDuration
I fixed it but another bug happen, and I fixed it finally with inserting these code below into your updateAttributedString

  if (now > self.endTime) {
    self.displaylink.paused = YES;

      for (NSUInteger i = 0; i < self.attributedString.length; i++) {
          self.characterAnimationDelays[i] = @(arc4random_uniform(self.fadeoutDuration / 2 * 100) / 100.0);
          CGFloat remain = self.fadeoutDuration - [self.characterAnimationDelays[i] floatValue];
          self.characterAnimationDurations[i] = @(arc4random_uniform(remain * 100) / 100.0);
      }

    if (self.completion) {
      self.completion();
    }

You use self.shineDuration in setAttributedText, it will affect the fadeoutAnimation, I add those code to update characterAnimationDurations to get the right fadeoutAnimation. Need pull request? Hope you can understand my Chiglish :)

@zipme
Copy link
Owner

zipme commented Dec 31, 2015

@zpz1237 能否发个PR我看下 😁

@zpz1237
Copy link
Author

zpz1237 commented Dec 31, 2015

马个鸡... 白扯那么久英文...

@zpz1237
Copy link
Author

zpz1237 commented Dec 31, 2015

我学一下怎么发PR..

@warpling
Copy link
Contributor

Bump! @zipme

@zipme zipme closed this as completed in a413e61 Feb 14, 2020
zipme added a commit that referenced this issue Feb 14, 2020
Fix animateOut duration bug (#15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants