思路简单,画出左边线,左边线,左边球,中间线中间球,右边线右边球,给左右边线球,添加动画。考虑到需求是计时动画,所以没有添加重力效果,弹簧效果。
画线画球
CAShapeLayer *leftLine = [CAShapeLayer layer];
self.leftLine = leftLine;
CGMutablePathRef leftPath = CGPathCreateMutable();
CGPathMoveToPoint(leftPath, nil, 0, 0);
CGPathAddLineToPoint(leftPath, nil, 0, 100);
self.leftLine.path = leftPath;
self.leftLine.frame = CGRectMake(65, 10, 100, 100);
self.leftLine.position = CGPointMake(65, 10);
self.leftLine.anchorPoint = CGPointMake(0, 0);
self.leftLine.strokeColor = [UIColor colorWithWhite:1 alpha:0.8].CGColor;
self.leftLine.lineCap = kCALineCapRound;
self.leftLine.lineWidth = 3;
[self setShadow:self.leftLine];
[self.layer addSublayer:self.leftLine];
[self.layerArray addObject:self.leftLine];
CAShapeLayer *leftCycle = [CAShapeLayer layer];
self.leftCycle = leftCycle;
CGMutablePathRef cyclePath