2016-11-11 11 views
0

enter image description here如何傾斜一個標籤轉發側,而不改變其x座標

我要讓像多米諾骨牌磚塊掉落在彼此的動畫,我希望有一個標籤是傾斜到前側即落在另一個標籤(動畫效果)。我正在使用變換方法,但我不知道它是如何完成的。我對座標中應該改變的內容感到困惑。

在此先感謝。

- (IBAction)moveButtonAction:(UIButton *)sender 
{ 

    [UIView animateWithDuration:3 animations:^{ 

     _brick1.transform =CGAffineTransformMake(_brick1.transform.a, _brick1.transform.b+5 , _brick1.transform.c , _brick1.transform.d, _brick1.transform.tx, _brick1.transform.ty); 
    }]; 

}

+1

沒有答案,但也許你想使用動態來存檔多米諾骨牌效應。尼斯教程:http://omarfouad.com/blog/2014/08/02/getting-started-uikitdynamics-swift/ – shallowThought

回答

-1
CALayer *layer = _brick1.layer; 
layer.transform = CATransform3DTranslate(...) 

應用視圖層的一些3D轉換。

+0

你能解釋一下怎麼做 – mukul

+0

U可以嘗試這樣 [UIView的animateWithDuration一些事情:3個動畫:CALayer * layer = _brick1.layer; CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity; rotationAndPerspectiveTransform.m24 = 0.005; layer.transform = CATransform3DRotate(rotationAndPerspectiveTransform,50 * M_PI/180.0f,1.0f,0.0f,0.0f); }];你可以根據你的需要應用不同的角度和價值。 –

+0

@VinayMaheshwari不要把你的答案放在評論中。更新您的答案以包含所需的代碼。 – rmaddy