iOS 动画(3)
ios 动画。
catransition动画设置两个uiview
uiview *magentaview =[[uiview alloc]initwithframe:self.view.bounds];
magentaview.backgroundcolor =[uicolor magentacolor];
[self.view addsubview:magentaview];
uiview * gtayview =[[uiview alloc]initwithframe:self.view.bounds];
gtayview.backgroundcolor =[uicolor lightgraycolor];
[self.view addsubview:gtayview];
//提交
-(void)add{
// 开始动画
[uiview beginanimations:@"animation" context:nil];
[uiview setanimationduration:1.0];
[uiview setanimationtransition:uiviewanimationtransitioncurldown forview:self.view cache:yes];
[uiview setanimationcurve:uiviewanimationcurveeaseinout];
[self.view exchangesubviewatindex:0 withsubviewatindex:1];
// 提交动画
[uiview commitanimations];
}
//翻页
-(void)curl
{
// 开始动画
[uiview beginanimations:@"animation" context:nil];
[uiview setanimationduration:1.0f];
[uiview setanimationtransition:uiviewanimationtransitioncurlup forview:self.view cache:yes];
[uiview setanimationcurve:uiviewanimationcurveeaseinout];
[self.view exchangesubviewatindex:0 withsubviewatindex:1];
// 提交动画
[uiview commitanimations];
}
//移入
-(void)move
{
catransition *strasiton =[catransition animation];
strasiton.duration = 2.0f;
// 使用kcatransitionmovein动画
strasiton.type = kcatransitionmovein;
// 指定动画方向,从左向右
strasiton.subtype = kcatransitionfromleft;
[self.view.layer addanimation:strasiton forkey:@"animation"];
[self.view exchangesubviewatindex:0 withsubviewatindex:1];
}
//揭开
-(void)reveal
{
catransition *strasiton =[catransition animation];
strasiton.duration = 2.0f;
// 使用kcatransitionreveal动画
strasiton.type = kcatransitionreveal;
strasiton.subtype = kcatransitionfromtop;
[self.view.layer addanimation:strasiton forkey:@"animation"];
[self.view exchangesubviewatindex:0 withsubviewatindex:1];
}
//立方体
-(void)cube
{
catransition *trasiton =[catransition animation];
trasiton.duration = 2.0f;
trasiton.type = @"cube";
trasiton.subtype = kcatransitionfromleft;
[self.view.layer addanimation:trasiton forkey:@"animation"];
[self.view exchangesubviewatindex:0 withsubviewatindex:1];
}
//吸入
-(void)suck
{
catransition *trasiton =[catransition animation];
trasiton.duration = 2.0f;
trasiton.type = @"suckeffect";
trasiton.subtype = kcatransitionfromleft;
[self.view.layer addanimation:trasiton forkey:@"animation"];
[self.view exchangesubviewatindex:0 withsubviewatindex:1];
}
//翻转
-(void)oglflip
{
catransition *trasiton =[catransition animation];
trasiton.duration = 2.0f;
trasiton.type = @"oglflip";
trasiton.subtype = kcatransitionfromleft;
[self.view.layer addanimation:trasiton forkey:@"animation"];
[self.view exchangesubviewatindex:0 withsubviewatindex:1];
}
//水波
-(void)ripple
{
catransition *trasiton =[catransition animation];
trasiton.duration = 2.0f;
trasiton.type = @"rippleeffect";
trasiton.subtype = kcatransitionfromleft;
[self.view.layer addanimation:trasiton forkey:@"animation"];
[self.view exchangesubviewatindex:0 withsubviewatindex:1];
}
上一篇: 这只苍蝇怕是飞不了了
下一篇: 数据库的相关概念、SQL及功能讲解