table view cell出現(xiàn)時(shí)的動(dòng)畫

#pragma mark - UITableViewDelegate

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{

? ? //動(dòng)畫1:

? ? if (![self.showIndexes containsObject:indexPath]) {

? ? ? ? [self.showIndexes addObject:indexPath];

? ? ? ? CGFloat rotationAngleDegrees = -30;

? ? ? ? CGFloat rotationAngleRadians = rotationAngleDegrees * (M_PI/ 180);

? ? ? ? CGPoint offsetPositioning = CGPointMake(-80, -80);



? ? ? ? CATransform3D transform = CATransform3DIdentity;

? ? ? ? transform = CATransform3DRotate(transform, rotationAngleRadians, 0.0,? 0.0, 1.0);

? ? ? ? transform = CATransform3DTranslate(transform, offsetPositioning.x, offsetPositioning.y , 0.0);


? ? ? ? cell.layer.transform = transform;

? ? ? ? cell.alpha = 0.7;

? ? ? ? [UIView animateWithDuration:1 delay:0.0 usingSpringWithDamping:0.6f initialSpringVelocity:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{

? ? ? ? ? ? cell.layer.transform = CATransform3DIdentity;

? ? ? ? ? ? cell.layer.opacity = 1;

? ? ? ? } completion:nil];

? ? }

? ? }


//動(dòng)畫2:

? ? if (![self.showIndexes containsObject:indexPath]) {

? ? ? ? [self.showIndexes addObject:indexPath];


? ? ? ? CATransform3D rotation;

? ? ? ? rotation = CATransform3DMakeRotation( (90.0*M_PI)/180, 0.0, 0.7, 0.4);

? ? ? ? rotation.m34 = 1.0/ -600;


? ? ? ? //2. Define the initial state (Before the animation)

? ? ? ? cell.layer.shadowColor = [[UIColor blackColor]CGColor];

? ? ? ? cell.layer.shadowOffset = CGSizeMake(10, 10);

? ? ? ? cell.alpha = 0;


? ? ? ? cell.layer.transform = rotation;

? ? ? ? cell.layer.anchorPoint = CGPointMake(0, 0.5);



? ? ? ? //3. Define the final state (After the animation) and commit the animation

? ? ? ? [UIView beginAnimations:@"rotation" context:NULL];

? ? ? ? [UIView setAnimationDuration:0.3];

? ? ? ? cell.layer.transform = CATransform3DIdentity;

? ? ? ? cell.alpha = 1;

? ? ? ? cell.layer.shadowOffset = CGSizeMake(0, 0);

? ? ? ? [UIView commitAnimations];

? ? }

//動(dòng)畫3:

? ? if (![self.showIndexes containsObject:indexPath]) {

? ? ? ? [self.showIndexes addObject:indexPath];

? ? ? ? cell.layer.transform = CATransform3DTranslate(cell.layer.transform, 300, 0, 0);

? ? ? ? cell.alpha = 0.5;

? ? ? ? [UIView animateWithDuration:0.3 delay:0.0f usingSpringWithDamping:0.8f initialSpringVelocity:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{

? ? ? ? ? ? cell.layer.transform = CATransform3DIdentity;

? ? ? ? ? ? cell.alpha = 1;

? ? ? ? } completion:nil];

? ? }

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 1 CALayer IOS SDK詳解之CALayer(一) http://doc.okbase.net/Hell...
    Kevin_Junbaozi閱讀 5,343評論 3 23
  • 在iOS中隨處都可以看到絢麗的動(dòng)畫效果,實(shí)現(xiàn)這些動(dòng)畫的過程并不復(fù)雜,今天將帶大家一窺ios動(dòng)畫全貌。在這里你可以看...
    每天刷兩次牙閱讀 8,697評論 6 30
  • UIView+SGFrame.h #import @interface UIView (SGFrame) @pro...
    超越時(shí)空的思念_8a22閱讀 1,964評論 1 1
  • 在iOS中隨處都可以看到絢麗的動(dòng)畫效果,實(shí)現(xiàn)這些動(dòng)畫的過程并不復(fù)雜,今天將帶大家一窺iOS動(dòng)畫全貌。在這里你可以看...
    F麥子閱讀 5,271評論 5 13
  • 寓居巴黎的年輕醫(yī)生馬內(nèi)特散步時(shí),突然被厄弗里蒙地侯爵兄弟強(qiáng)迫出診。在侯爵府第中,他目睹一個(gè)發(fā)狂的絕色農(nóng)婦和一個(gè)身受...
    谷音sp閱讀 303評論 0 0

友情鏈接更多精彩內(nèi)容