ios动态效果实现翻页_ios animation 动画效果实现
过渡动画 CATransition
CATransition *animation = [CATransition animation];
[animation setDuration:1.0];
[animation setType:kCATransitionFade];
[animation setSubtype:kCATransitionFromLeft];
[_imgPic.layer addAnimation:animation forKey:nil];
说明:
(1).Duration 延迟
(2).Type
kCATransitionFade // 交叉淡化过渡(不支持过渡方向)
kCATransitionMoveIn // 新视图移到旧视图上面
kCATransitionPush // 新视图把旧视图推出去
kCATransitionReveal // 将旧视图移开,显示下面的新视图
cube // 立方体翻滚效果
oglFlip // 上下左右翻转效果
suckEffect // 收缩效果,如一块布被抽走(不支持过渡方向)
rippleEffect // 滴水效果(不支持过渡方向)
pageCurl // 向上翻页效果
pageUnCurl // 向下翻页效果
cameraIrisHollowOpen // 相机镜头打开效果(不支持过渡方向)
cameraIrisHollowClose // 相机镜头关上效果(不支持过渡方向)
2.路径动画 CAKeyframeAnimation
CAKeyframeAnimation *ani=[CAKeyframeAnimation animation];
CGMutablePathRef aPath=CGPathCreateMutable();
CGPathMoveToPoint(aPath, nil, , );
CGPathAddCurveToPoint(aPath, nil,
, ,
, ,
, );
ani.path=aPath;
ani.duration=;
使用方括号将指定名为kCAMediaTimingFunctionEaseIn的函数名称分配给ani.timingFunction采用花括号表示
ani.rotationMode=@"autoReverse";
[redView.layer addAnimation:ani forKey:@"position"];
//特殊曲线 贝塞尔曲线
//贝塞尔曲线路径
UIBezierPath *movePath = [UIBezierPath bezierPath];
[movePath moveToPoint:CGPointMake(0.0, 0.0)];
将移动路径上的二次曲线添加到屏幕宽度的一半和高度的一半位置,并将整个宽度与整个高度作为控制点设置
说明:(1).moveToPoint :动画起始位置
(2).轨迹
- (void)insertQuadraticCurveToPoint:endPoint坐标 controlPoint:控制点坐标;
//endPoint 完成位置 controllerPoint 轨迹中的位置
3.基本类型 CABasicAnimation 事例
//背景色动画
CABasicAnimation *animation=[CABasicAnimation animation];
//设置颜色
animation.toValue=(id)[UIColor blueColor].CGColor;
//动画时间
animation.duration=;
//是否反转变为原来的属性值
animation.autoreverses=YES;
通过将 animation 添加到图层中的 layer 中, 便可以播放动画了. forKey 设置为 animation 的属性来应用.
[self.view.layer addAnimation:animation forKey:@"backgroundColor"];
//缩放动画
CABasicAnimation *scaleAnim = [CABasicAnimation instance of animationWithKeyPath:@"transform"];
用于生成动画的缩放属性被设置为由一个NSValue对象生成的转换矩阵,并对该矩阵应用了缩放变换(比例为x轴和y轴各缩放到0.1倍而z轴保持不变)。
属性 scaleAnim.toValue 被赋值为通过 valueWithCATransform3D 创建的一个具有 CATTransform3DIdentity 矩阵的新实例
scaleAnim.removedOnCompletion = YES;
//透明动画
CABasicAnimation *opacityAnim赋值为 alpha动画效果
opacityAnim.fromValue = [NSNumber numberWithFloat:1.0];
opacityAnim.toValue = [NSNumber numberWithFloat:0.1];
opacityAnim.removedOnCompletion = YES;
4. UIViewAnimationWithBlocks
+(animatedTransitionWith: UIView *view duration: NSTimeInterval duration options: UIViewAnimationOptions animationOptions animations: (void (^)(void)) animations completion: (void (^)(BOOL finished)) completion)
+ (void)createAnimationForDuration:NSTimeInterval, delayForExecution:NSTimeInterval, withOptions:UIViewAnimationOptions animations:(Closure (^)(void))animations completion:(Closure (^ __nullable)(BOOL finished))completion
// UIViewAnimationOptions
UIViewAnimationOptionLayoutSubviews // 当触发或执行动画时会安排这些子组件,并确保它们与父组件同步进行动画效果。
UIViewAnimationOptionAllowUserInteraction //支持人机交互,并非仅限于触控操作
UIViewAnimationOptionBeginFromCurrentState //从当前状态开始动画
UIViewAnimationOptionRepeat //动画无限重复
UIViewAnimationOptionAutoreverse //触发动画循环,仅当设定为无限重复时
UIViewAnimationOptionOverrideInheritedDuration // 忽略外围动画嵌入操作的时间消耗
UIViewAnimationOptionOverrideInheritedCurve //不考虑外围动画层次的时间变化的曲线
UIViewAnimationOptionAllowAnimatedContent //通过调整属性设置和重新渲染实现动画效果;如果没有提交动画内容则采用截屏快照
UIViewAnimationOptionShowHideTransitionViews //显示-隐藏的方式取代手动增减图层的动态视觉效果
UIViewAnimationOptionOverrideAvoidingNestedClassOptions //避免考虑嵌套类别的选项
//时间函数曲线相关
UIViewAnimationOptionCurveEaseInOut //时间曲线函数,由慢到快
UIViewAnimationOptionCurveEaseIn //时间曲线函数,由慢到特别快
UIViewAnimationOptionCurveEaseOut //时间曲线函数,由快到慢
UIViewAnimationOptionCurveLinear //时间曲线函数,匀速
//转场动画相关的
UIViewAnimationOptionTransitionNone //无转场动画
UIViewAnimationOptionTransitionFlipFromLeft //转场从左翻转
UIViewAnimationOptionTransitionFlipFromRight //转场从右翻转
UIViewAnimationOptionTransitionCurlUp //上卷转场
UIViewAnimationOptionTransitionCurlDown //下卷转场
UIViewAnimationOptionTransitionCrossDissolve //转场交叉消失
UIViewAnimationOptionTransitionFlipFromTop //转场从上翻转
UIViewAnimationOptionTransitionFlipFromBottom //转场从下翻转
测试demo:https://github.com/lvdachao/animation
iOS各种动画效果
启动指定的UIView并设置其 animations属性值
Android中xml设置Animation动画效果详解
在 Android 设备上, 实现动画效果可采用两种方式: 一种是渐变动画 (tweened animation), 另一种是逐帧动画 (frame-by-frame animation)
android中设置Animation 动画效果
在Android平台上, 实现动画效果可通过两种主要方式完成: 一种是tweened animation, 另一种是逐帧动画
复制并制作百度首页的元宵节汤圆动态图片,并运用CSS3的animation属性实现其360度无停旋转的效果
复制官方首页上'元宵节汤圆'动态图片,并利用CSS3的animation属性实现持续360度旋转的效果展示。展示效果:截取链接https://ss1.bdstatic.com/5eN1bjq8AAUYm2zg ...
Swift 实现iOS Animation动画教程
这篇文章是一篇翻译作品。原文出处为:http://www.raywenderlich.com/95910/uiview-animation-swift-tutorial。动效( animation)是iOS开发者使用的 ...
iOS的动画效果类型及实现方法
主要通过以下两种方式实现iOS漂亮的动画效果:一种是基于UIView框架的方法;另一种则是通过采用CATransition技术进行更为细致的动画控制。其中一种方案在细节处理上同样采用了CATransition技术。
android Animation 动画效果介绍
Android中的animation包含四种不同的类型:在XML中实现了alpha渐变透明度的动画效果、尺寸渐变的伸缩 animation effect以及基于画面对接的位置移动与旋转 animation effect等技术特征
iOS开动画效果之──实现 pushViewController 默认动画效果
在开发过程中,视图切换是一项常见的操作,在某些场景下,并非总是基于导航控制器的方式来完成切换,在实际应用开发中,则常常会遇到需要特殊处理的情况:例如如何通过代码实现Push与Pop两种不同默认动画效果的具体方法与技术路径:其中以CATrans为例进行了详细的演示与实践操作
Android Animation动画效果简介
AlphaAnimation represents the process where an object transitions from one state to another with gradual intensity changes, typically involving opacity and size modifications over time. It includes both fade-in and fade-out animations, which occur at different stages of the animation sequence to create smooth visual transitions. Each animation type can be independently controlled for timing and intensity parameters to achieve desired visual effects.
随机推荐
Cordova学习(一) 环境搭建
一.什么是cordova Cordova提供了针对设备的一系列API接口。借助这些API接口,移动应用能够通过JavaScript脚本调用设备上的原生功能,例如摄像头、麦克风等其他相关设备功能。此外,Cordova还提供了一组统一的Java ...
A Tour of Go Mutating Maps
Set a value for key in map m: m[\texttt{key}] = \texttt{elem}
Obtain the value from map m: \texttt{elem} = m[\texttt{key}]
Remove a value from map m: \texttt{del} \, m[\texttt{key}]
Oracle配置
配置Oracle 11g实例可以通过Database Configuration Assistant工具生成新的数据库配置文件,在建立新数据库时,请务必记住其名称和 SID参数。完成安装后,请确保SCOTT用户的账户已解密,并将登录密码设置为TIGER。
【Express】请求和响应对象
浏览器传输的数据通过调用app.get('/headers')函数来获取相关信息。该函数会设置响应头中的'Content-Type'字段为'text/plain'类型,并声明一个空字符串变量s用于后续操作。
Socket 学习(三).4 UDP 穿透 客户端与客户端连接
效果展示图:请按照以下步骤进行操作:首先,请编辑WinClient\bin\Debug文件中的ip.ini,并在相应位置输入服务器IP地址;在客户端与客户端建立通信之前,请先点击发送打洞消息按钮;随后,在一段时间后再次发送消息。
OSI七层模型对应的协议
OSI七层模型对应的主要协议由[用户]编写于2017年10月21日于上午11点44分完成。该作品为个人原创内容,请转载时务必注明出处,并依法承担相关法律责任。OSI七层模型对应的主要协议由[用户]编写于2017年...
[Redis]Redis高级特性的配置及使用
---------------------------------------------------------------------------- [Redis安全性] 一 . 默认我们进入Re ...
js+正则+单双引号问题
在使用JavaScript动态添加表格时,在涉及正则表达式的场景中(即当使用带有单双引号的正则表达式时),由于其使用的单双引号问题导致无法成功创建或显示该表格;此外还存在正则表达式失效的问题。
swift 快速创建一些基本控件
- tableView private lazy var cellId = "cellId" recursively touch var tv : UITableView = { l ...
