开发者

Timing function for "Wheel of Fortune" style ticker

I'm trying to create a function that changes a lab开发者_开发技巧el's text. I want it in a "Wheel of Fortune" style where the text changes really quickly at first but slows down over time, then stops at the final text. I have the text as strings in an array.

I'm guessing I would need an exponential function to do this but maths is not my strong point. Currently I'm trying:

- (void)timer {
   float time = 0.5;
   float increase = 0.05;
   for(int x = 0; x < 100; x++) {
      sleep(time);
      time = time + increase;
      NSLog(@"%f", time); //Log to show time of each iteration
   }
}

I don't need help linking it up with labels etc., I just need help to get the timing right.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜