我有一個奇怪的問題,在我的連鎖動畫之一。我有我的屏幕上的每個塊(其中26個)的塊對象,當用戶按下它們時,我執行翻轉。它的效果很好,但我在添加一個縮放動畫之前,先讓它們在屏幕上放大50%。所以,我的順序是:ios transform.rotation.y打破窗口
放大 延遲(讓用戶看大圖) 旋出90%(去除視圖塊) - 使用transform.rotation.y 變化圖像&旋入式表 收縮。
我已經設置了窗口視圖控制器作爲這些塊的委託,這樣它可以傳遞一個計數器給塊,這樣我就可以在右上方放置正確的子圖層(使用setZposition)。
這一切都很好,除非在屏幕上有兩個相互位於上方/下方的塊,這樣放大會導致它們重疊,然後當旋轉動畫開始時,它立即具有塊的右側在它下面的塊後面彈出。我已經嘗試將動畫更改爲transform.rotation.x,並在塊是並排時獲得相同的行爲。
我不確定這是否是iOS錯誤,如果我只是沒有做正確的事情。任何建議,非常感謝。這裏是分拆方法:
- (void)spinOut:(id)sender
{
NSTimeInterval animationTime=0.85;
[UIView animateWithDuration:animationTime
delay:0
options: UIViewAnimationOptionCurveLinear
animations:^{
// setup the animation to spin the current view out
[CATransaction begin];
[CATransaction setDisableActions:YES];
CABasicAnimation *spinOut = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
[spinOut setDelegate:self];
[spinOut setDuration:animationTime];
CAMediaTimingFunction *tf = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
[spinOut setTimingFunction:tf];
[spinOut setFromValue:[NSNumber numberWithFloat:M_PI * 0.0]];
[spinOut setToValue:[NSNumber numberWithFloat:M_PI * 0.5]];
[spinOut setRemovedOnCompletion:NO];
[spinOut setFillMode:kCAFillModeForwards];
// setup variables used to roll in the next view on animation completion.
[pageView.layer addAnimation:spinOut forKey:kMyVeryOwnABCsSpinOutKey];
[CATransaction commit];
}
completion:^(BOOL finished){
[self setFlipOutAnimationTimer:[NSTimer scheduledTimerWithTimeInterval:animationTime target:self selector:@selector(spinIn:) userInfo:nil repeats:NO]];
}];
}
好吧 - 這是一個模糊的問題,我只是在縮小圖像之後做旋轉。我猜想夠好了。 – jpporterVA