时间:2017年05月15日星期一
说明:本文部分内容均来自慕课网。@慕课网:http://www.imooc.com
教学示例源码:https://github.com/zccodere/s...
个人学习源码:https://github.com/zccodere/s...
iOS动画课程概述
为什么使用动画 制作动画的原理 制作动画的基础 一些动画特效的实现第二章:创建动画的灵感 2-1 iOS动画的原理
动画技术较规范的定义是采用逐帧拍摄对象并连续播放而形成运动的影像技术。
2-2 寻找灵感-Dribbble网址:https://dribbble.com/
2-3 寻找灵感-Capptivate网址:http://capptivate.co/
2-4 寻找灵感-Google Material Design网址:http://www.google.com/design/...
第三章:UIView动画详解 3-1 UIView动画概述相关类图
UIView动画
位置:Position 透明度:Opacity 缩放:Scale 颜色:Color 翻转:Rotation
项目整体概览
3-2 Position动画上代码演示:
// // PositionViewController.swift // iOSAnimationDemo // // Created by zc on 2017/5/22. // Copyright © 2017年 com.zccoder. All rights reserved. // import UIKit class PositionViewController: UIViewController { // 蓝色正方形 @IBOutlet weak var blueSquare: UIView! // 红色正方形 @IBOutlet weak var redSquare: UIView! // 绿色正方形 @IBOutlet weak var greenSquare: UIView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) // 动画效果一 UIView.animate(withDuration: 2, animations: { // 从左边移动到右边 self.blueSquare.center.x = self.view.bounds.width - self.blueSquare.center.x // 从顶部移动到底部 self.redSquare.center.y = self.view.bounds.height - self.redSquare.center.y // 同时从左边到右边和从顶部到底部 self.greenSquare.center.x = self.view.bounds.width - self.greenSquare.center.x self.greenSquare.center.y = self.view.bounds.height - self.greenSquare.center.y }) } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
效果如下:
3-3 Position动画下代码演示:
// // PositionViewController.swift // iOSAnimationDemo // // Created by zc on 2017/5/22. // Copyright © 2017年 com.zccoder. All rights reserved. // import UIKit class PositionViewController: UIViewController { // 蓝色正方形 @IBOutlet weak var blueSquare: UIView! // 红色正方形 @IBOutlet weak var redSquare: UIView! // 绿色正方形 @IBOutlet weak var greenSquare: UIView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) // 动画效果一 UIView.animate(withDuration: 2, animations: { // 从左边移动到右边 self.blueSquare.center.x = self.view.bounds.width - self.blueSquare.center.x }) // 动画效果二 UIView.animate(withDuration: 1, delay: 0.5, animations: { super.viewDidAppear(animated) // 从顶部移动到底部 self.redSquare.center.y = self.view.bounds.height - self.redSquare.center.y }, completion: nil) // 动画效果三 UIView.animate(withDuration: 1, delay: 1, animations: { super.viewDidAppear(animated) // 同时从左边到右边和从顶部到底部 self.greenSquare.center.x = self.view.bounds.width - self.greenSquare.center.x self.greenSquare.center.y = self.view.bounds.height - self.greenSquare.center.y }, completion: nil) } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
效果如下:
3-4 Opacity动画代码演示:
// // OpacityViewController.swift // iOSAnimationDemo // // Created by zc on 2017/5/22. // Copyright © 2017年 com.zccoder. All rights reserved. // import UIKit class OpacityViewController: UIViewController { // 蓝色正方形 @IBOutlet weak var blueSquare: UIView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) // 动画效果一 UIView.animate(withDuration: 1, animations: { // 淡化效果 self.blueSquare.alpha = 0.2 }) } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
效果如下:
3-5 Scale动画代码演示:
// // ScaleViewController.swift // iOSAnimationDemo // // Created by zc on 2017/5/22. // Copyright © 2017年 com.zccoder. All rights reserved. // import UIKit class ScaleViewController: UIViewController { // 蓝色正方形 @IBOutlet weak var blueSquare: UIView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) UIView.animate(withDuration: 1, animations: { // 放大2.0倍 self.blueSquare.transform = CGAffineTransform(scaleX: 2.0,y: 2.0) // 缩小0.3倍 //self.blueSquare.transform = CGAffineTransform(scaleX: 2.0,y: 2.0) }) } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
效果如下:
3-6 Color动画代码演示:
// // ColorViewController.swift // iOSAnimationDemo // // Created by zc on 2017/5/22. // Copyright © 2017年 com.zccoder. All rights reserved. // import UIKit class ColorViewController: UIViewController { // 蓝色正方形 @IBOutlet weak var blueSquare: UIView! // label @IBOutlet weak var name: UILabel! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) UIView.animate(withDuration: 1, animations:{ self.blueSquare.backgroundColor = UIColor.red self.name.textColor = UIColor.white }) } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
效果如下:
3-7 Rotation动画代码演示:
// // RotationViewController.swift // iOSAnimationDemo // // Created by zc on 2017/5/22. // Copyright © 2017年 com.zccoder. All rights reserved. // import UIKit class RotationViewController: UIViewController { // 轮转图 @IBOutlet weak var wheel: UIImageView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func spin() { UIView.animate(withDuration: 1, delay: 0, options: UIViewAnimationOptions.curveLinear, animations: { // 旋转半圈 //(translationX: self.wheel.transform, y: CGFloat(Double.pi)) self.wheel.transform = self.wheel.transform.rotated(by: CGFloat(Double.pi)) }, completion: {(finished) -> Void in self.spin() }) } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) self.spin() } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
效果如下:
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/16763.html
摘要:时间年月日星期一说明本文部分内容均来自慕课网。慕课网教学示例源码个人学习源码第一章动画进阶学习课程前,请先学习慕课网动画入门学习总结。 时间:2017年05月22日星期一说明:本文部分内容均来自慕课网。@慕课网:http://www.imooc.com教学示例源码:https://github.com/zccodere/s...个人学习源码:https://github.com/zcc...
时间:2017年05月10日星期三说明:本文部分内容均来自慕课网。@慕课网:http://www.imooc.com教学示例源码:无个人学习源码:https://github.com/zccodere/s... 第一章:Foundation结构简介 1-1 Foundation结构关系 Foundation.framework Foundation:基础 framework:框架 基础框架 Fou...
时间:2017年10月16日星期一说明:本文部分内容均来自慕课网。@慕课网:http://www.imooc.com教学源码:无学习源码:https://github.com/zccodere/s... 第一章:课程简介 1-1 课程介绍 本门课程的主要内容 RxJava是什么 RxAndroid是什么 RxJava常用操作符(重点、难点) 怎样在项目中使用RxJava和RxAndroid 如何学...
时间:2018年04月11日星期三 说明:本文部分内容均来自慕课网。@慕课网:https://www.imooc.com 教学源码:https://github.com/zccodere/s... 学习源码:https://github.com/zccodere/s... 第一章:课程介绍 1-1 课程介绍 什么是Netty 高性能、事件驱动、异步非阻塞的IO Java开源框架 基于NIO的客户...
摘要:时间年月日星期日说明本文部分内容均来自慕课网。慕课网教学示例源码无个人学习源码第一章课程概述课程介绍课程须知本课程面向所有使用语言进行开发的小伙伴。 时间:2017年05月21日星期日说明:本文部分内容均来自慕课网。@慕课网:http://www.imooc.com教学示例源码:无个人学习源码:https://github.com/zccodere/s... 第一章:课程概述 1-1 ...
阅读 1472·2021-11-24 09:39
阅读 3369·2021-11-24 09:39
阅读 2128·2021-11-15 11:37
阅读 1939·2021-11-11 16:55
阅读 4340·2021-10-14 09:43
阅读 3508·2021-10-08 10:05
阅读 2776·2021-09-13 10:26
阅读 2111·2021-09-08 09:35