HyRoundMenuView
HyRoundMenuView copied to clipboard
Why HyRoundShapeLayer class delay calling "setPath:"
`- (void)setPath:(CGPathRef)path { [super setPath:path];
CABasicAnimation *opacity = [self opacityAnimation:1 fromValue:0];
[self addAnimation:opacity forKey:opacity.keyPath];
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // [super setPath:path]; // CABasicAnimation *opacity1 = [self opacityAnimation:1 fromValue:0]; // [self addAnimation:opacity1 forKey:opacity1.keyPath]; // });
}
- (CABasicAnimation *)opacityAnimation:(CGFloat)opacity fromValue:(CGFloat)fromValue; { CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"opacity"]; animation.fromValue = [NSNumber numberWithFloat:fromValue]; animation.toValue = [NSNumber numberWithFloat:opacity]; animation.duration = 0.2; animation.autoreverses = NO; animation.repeatCount = 0; animation.removedOnCompletion = NO; animation.fillMode = kCAFillModeForwards; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; return animation; }`
I try to modified code like that, and found work well , i do not understand why should delay calling ?Thank You sincerely.