2012-03-23 51 views
1

我想沿着路徑爲視圖設置動畫。當它從路徑的開始移動到結束時,我也希望它可以放大。要開始,我將縮放比例應用於視圖(.1比例)。沿着路徑移動的效果很好,但我在動畫過程中應用了從縮放到正常的轉換時遇到了問題。CAKeyAnimation with CATransform3D

 PointF p0 = pt; 
     PointF p3 = FormCenter; 

     CGPath path = new CGPath(); 
     path.MoveToPoint(p0); 
     path.AddQuadCurveToPoint(p3.X, p0.Y, p3.X, p3.Y); 

     CAKeyFrameAnimation a = new CAKeyFrameAnimation(); 
     a.KeyPath = "position"; 
     a.Path = path; 
     a.Values = new NSObject[1] {NSValue.FromCATransform3D(CATransform3D.Identity)}; 
     a.Duration = 3; 
     nav.View.Layer.AddAnimation(a, a.KeyPath); 

回答

1

您需要創建一組動畫,動畫多個屬性

在這種情況下,假設你已經創建了兩個動畫,一個用於動畫的α,和一個用於動畫的zie,你這是怎麼創建它:

var group = CAAnimationGroup.CreateAnimation(); 
group.Animations = new CAAnimation [] { alpha, size }; 
group.Duration = delay; 
layer.AddAnimation (group, "showup");