iOS 跳动数字,展示分数

#pragma mark 、展示分数

- (void)labelDanceAnimation:(NSTimeInterval)duration

{

    _showAddScoreLabel.hidden = NO;

    __weaktypeof(self) weakSelf =self;

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

        weakSelf.showAddScoreLabel.hidden=YES;

    });

    CABasicAnimation *opacityAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];

    opacityAnimation.duration=0.4* duration;

    [email protected];

    [email protected];


    CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];

    scaleAnimation.duration= duration;

    scaleAnimation.values=@[@3.f,@1.f,@1.2f,@1.f];

    scaleAnimation.keyTimes=@[@0.f,@0.16f,@0.28f,@0.4f];

    scaleAnimation.removedOnCompletion=YES;

    scaleAnimation.fillMode = kCAFillModeForwards;

    CAAnimationGroup *animationGroup = [CAAnimationGroup animation];

    animationGroup.animations=@[opacityAnimation, scaleAnimation];

    animationGroup.duration= duration;

    animationGroup.removedOnCompletion=YES;

    animationGroup.fillMode = kCAFillModeForwards;

    [self.showAddScoreLabel.layeraddAnimation:animationGroupforKey:@"kComboAnimationKey"];


}

你可能感兴趣的:(iOS 跳动数字,展示分数)