有关动画的code(2中 以后慢慢添加)
2015-08-11 08:56
253 查看
//CABasicAnimation
[blackView.layer
addAnimation:[self
opacityForever_Animation:3.0]
forKey:@"key"];
//UIView Animation
[self animationRevealFromBotton:100];
transform.scale.x 宽的比例转换
transform.scale.y 高的比例转换
transform.rotation.z 平面圆的旋转
opacity 透明度
margin 在视图中展示内容的大小
zPosition 屏幕上层次的前后顺序
backgroundColor 背景颜色
cornerRadius 圆角
borderWidth 边的宽度
bounds layer的边界矩阵, 与frame类似contents
内容, 例如:图片的变化 contentsRect
内容可使用layer的大小frame 视图的frame矩阵hidden
隐藏状态 mask 遮挡背景和内容显示的透明度 masksToBounds
决定子layer是否从layer的边界中剪除position layer在其父layer中对应的位置shadowColor
阴影颜色shadowOffset 阴影偏移量shadowOpacity
阴影透明度shadowRadius 阴影圆角
- (CABasicAnimation *)opacityForever_Animation:(float)time
//永久闪烁的动画:渐变
{
//参数必须是layer的属性“属性”
CABasicAnimation *animation=[CABasicAnimation
animationWithKeyPath:@"backgroundColor"];
//属性的值的变换
// animation.fromValue=[NSNumber numberWithFloat:1.0];
// animation.toValue=[NSNumber numberWithFloat:3.0];
//位置变换 点对点
animation.fromValue = [NSValue
valueWithCGPoint:CGPointMake(125,
125)];
animation.toValue = [NSValue
valueWithCGPoint:CGPointMake(self.view.frame.size.width /
2, self.view.frame.size.height /
2)];
animation.autoreverses=YES;
//持续时间
animation.duration=time;
//重复次数
animation.repeatCount=FLT_MAX;
animation.removedOnCompletion=NO;
animation.fillMode=kCAFillModeForwards;
return animation;
}
- (void)animationRevealFromBotton:(float)duration
{
[UIView animateWithDuration:duration
animations:^{
blackView.transform =
CGAffineTransformMakeScale(0.001,
0.001);
CABasicAnimation *animation = [CABasicAnimation
animationWithKeyPath:@"transform"];
animation.toValue = [NSValue
valueWithCATransform3D:CATransform3DMakeRotation(M_PI,
0.70, 0.40,
0.80)];
animation.duration =
0.45;
animation.repeatCount =
FLT_MAX;
[blackView.layer
addAnimation:animation forKey:nil];
} completion:^(BOOL finished) {
[UIView animateWithDuration:duration
animations:^{
blackView.transform =
CGAffineTransformMakeScale(1.0,
1.0);
}];
}];
}
相关文章推荐
- Gifski:一个跨平台的高质量 GIF 编码器
- 模仿动画的放大缩小容器
- php判断GIF图片是否为动画的方法
- jQuery实现动画效果circle实例
- 浅析JavaScript动画
- js排序动画模拟-插入排序
- javascript+HTML5的Canvas实现Lab单车动画效果
- jquery实现先淡出再折叠收起的动画效果
- jQuery使用animate创建动画用法实例
- jQuery动画特效实例教程
- JQuery动画和停止动画实例代码
- JQuery动画与特效实例分析
- Jquery 自定义动画概述及示例
- 基于jquery的动画效果代码
- 锋利的jQuery 要点归纳(三) jQuery中的事件和动画(上:事件篇)
- 基于Jquery的温度计动画效果
- javascript与css3动画结合使用小结
- javascript动画算法实例分析
- js运动动画的八个知识点
- 深入探究使JavaScript动画流畅的一些方法