我想要实现的是能够沿着路径在指定位置沿路径设置图像的动画和位置。路径上的百分比很好。
我想要实现的目标:
当我设置动画时,它会在整个路径上动画,回到起点。我需要知道如何在路径的任何地方指定一个停靠点。
片段如下:
imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"EMOTICON_0.png"]];
[view addSubview:imageView];
CAKeyframeAnimation *positionAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
positionAnimation.path = [view path].CGPath;
positionAnimation.rotationMode = kCAAnimationRotateAuto;
positionAnimation.removedOnCompletion = NO;
positionAnimation.fillMode = kCAFillModeForwards;
positionAnimation.duration = 5.0;
positionAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[imageView.layer addAnimation:positionAnimation forKey:positionAnimation.keyPath];