类似加入购物车的抛物线动画

来源:互联网 发布:日照淘宝客服 编辑:程序博客网 时间:2024/05/17 06:44
    CAKeyframeAnimation *keyframeAnimation=[CAKeyframeAnimation animationWithKeyPath:@"position"];//抛物线运动    CGMutablePathRef path = CGPathCreateMutable();    CGPathMoveToPoint(path, NULL, testView.layer.position.x, testView.layer.position.y);//移动到起始点    CGPathAddQuadCurveToPoint(path, NULL, midPoint.x, midPoint.y, endPoint.x, end.y);    keyframeAnimation.path = path;    keyframeAnimation.delegate = self;    CGPathRelease(path);    keyframeAnimation.duration = 2;    [testView.layer addAnimation:keyframeAnimation forKey:@"KCKeyframeAnimation_Position"];    //旋转运动     CABasicAnimation *basicAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];    basicAnimation.duration = 0.2;    basicAnimation.repeatCount = 10;    basicAnimation.removedOnCompletion = NO;    basicAnimation.toValue = @(M_PI);    [testView.layer addAnimation:basicAnimation forKey:@"basic"];    //缩放运动    CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];        scaleAnimation.duration = 2;    scaleAnimation.toValue = @(0.1);    [testView.layer addAnimation:scaleAnimation forKey:@"scale"];

0 0
原创粉丝点击