我使用下面的函數來一個脈衝效果應用到視圖從CATransform3D到CGAffineTransform
- (void)pulse {
CATransform3D trasform = CATransform3DScale(self.layer.transform, 1.15, 1.15, 1);
trasform = CATransform3DRotate(trasform, angle, 0, 0, 0);
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.toValue = [NSValue valueWithCATransform3D:trasform];
animation.autoreverses = YES;
animation.duration = 0.3;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.repeatCount = 2;
[self.layer addAnimation:animation forKey:@"pulseAnimation"];
}
我想獲得使用CGAffineTransform self.transform代替CATransform3D自我相同的結果。 layer.transform。這可能嗎?
出於好奇,爲什麼會如果您已經從前者獲得了您期望的結果,您是否在意將CATransform3D應用於圖層還是將CGAffineTransform應用於視圖? –
,因爲self.layer.transform的初始值與self.transform不同,不是嗎? – Abramodj
我的意思是,在採用脈衝方法之前,我對視圖應用了一些仿射變換,但是我沒有觸及圖層,所以我猜想變換是那裏的標識 – Abramodj