zipme / RQShineLabel

Secret app like text animation
MIT License
1.97k stars 218 forks source link

found some bugs with _fadeoutDuration #15

Closed zpz1237 closed 4 years ago

zpz1237 commented 8 years ago

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 commented 8 years ago

@zpz1237 能否发个PR我看下 😁

zpz1237 commented 8 years ago

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

zpz1237 commented 8 years ago

我学一下怎么发PR..

warpling commented 4 years ago

Bump! @zipme