首页 > 代码库 > Core Animation 学习笔记(一)
Core Animation 学习笔记(一)
看到网易贴吧的点赞的动画,模仿做了个差不多的效果
-(void)zanAction { UILabel *oneLbl =[[UILabel alloc]init]; oneLbl.frame = CGRectMake(_zanBtn.frame.origin.x, _zanBtn.frame.origin.y, 35, 20); oneLbl.text =@"+1"; oneLbl.font = [UIFont boldSystemFontOfSize:17.0]; oneLbl.textColor = [UIColor colorWithRed:236/255.0 green:93/255.0 blue:114/255.0 alpha:0.8]; CGRect rect =_zanBtn.frame; [_zanBtn setImage:[UIImage imageNamed:@"praised.png"] forState:UIControlStateNormal]; [UIView animateWithDuration:0.2+3 delay:0 options:0 animations:^{ _zanBtn.frame = CGRectMake(_zanBtn.frame.origin.x, _zanBtn.frame.origin.y, _zanBtn.frame.size.width*1.2, _zanBtn.frame.size.height*1.2); } completion:^(BOOL finished){ _zanBtn.frame =rect; [UIView animateWithDuration:0.8+3 delay:0 options:0 animations:^{ [self.view addSubview:oneLbl]; //上、右移动10px 增大到1.2倍 oneLbl.frame = CGRectMake(oneLbl.frame.origin.x , oneLbl.frame.origin.y-25, oneLbl.frame.size.width*1.4, oneLbl.frame.size.height*1.4); oneLbl.alpha = 0; } completion:^(BOOL finished){ [oneLbl removeFromSuperview]; }]; }] ; }
Core Animation 学习笔记(一)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。