您的位置:首页 > 其它

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

2016-09-23 17:37 274 查看
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"];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  购物车抛物线