animation

隐式动画和核心动画

旧巷老猫 提交于 2020-04-04 18:53:33
1. 隐式动画,只有非根层的CALayer才有隐式动画,即改变图层的属性的时候,比如大小,颜色等,会自动添加一个颜色效果, 根层:控件里面的CALayer 非根层:自己创建的CALayer,不依附控件存在的CALayer 隐式动画的使用场景不多 2. 核心动画: Core Animation是一组非常强大的动画处理API,使用它能做出非常炫丽的动画效果,而且往往是事半功倍。也就是说,使用少量的代码就可以实现非常强大的功能。Core Animation可以用在Mac OS X和iOS平台。Core Animation的动画执行过程都是在后台操作的,不会阻塞主线程。 要注意的是,Core Animation是直接作用在CALayer上的,并非UIView。CALayer中很多属性都可以通过CAAnimation实现动画效果,包括:opacity、position、transform、bounds、contents等,通过调⽤用CALayer的addAnimation:forKey增加动画到层(CALayer)中,这样就能触 发动画了。 CAAnimation的继承结构如下: 注意: 这个核心动画仅仅是一个效果,动画结束之后并不保存动画结束之后的值,要想保存动画结束之后的值,两种方案 1.使用animationstop方法(CAAnimation的代理方法)

图层与核心动画

我们两清 提交于 2020-04-04 18:52:47
一、理解图层与UIView的关系 1.UIView能显示在屏幕上,是因为里面有个图层,UIView的DrawRect方法,会将绘制的东西绘在图层上,当要显示的时候,将图层拷贝到屏幕上进行显示 二、CALayer的基本属性 1.尺寸(bounds) 2.背影颜色(backgroundColor) 3.位置(position) 4.边框颜色(borderColor)、边框长度(borderWidth) "配合使用才有效果" 5.圆角(cornerRadius) 6.内容对象(contents) 通常设置图片, *如果要显示圆角效果,必须设置图层的masksToBounds为YES,意思是把多余的剪切掉 7.阴影属性 *阴影颜色(shadowColor)、阴影透明度(shadowOpacity) "要配合使用才有效果" *阴影起始位置(shadowOffset) *如果图片添加了圆角并设置了剪切掉多余的部分,阴影效果不会出现 *如果又想图片有圆角效果,又想有阴影,那图片只能是本来就有圆角效果的,不用代码设置 8. transform(CATransform3D)属性 *缩放CATransform3DMakeScale *旋转CGAffineTransformMakeRotation,理解xyz方向的意思 *平移CATransform3DMakeTranslation

filter: hue-rotate() 制作炫酷的文字效果

浪尽此生 提交于 2020-04-04 16:49:40
主要用到属性有: filter 滤镜的 hue-rotate 色调旋转, text-shadow 文字阴影, transform 的 scale 缩放, transition 过渡属性, animation 动画 效果图: 代码: 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <meta http-equiv="X-UA-Compatible" content="ie=edge"> 7 <title>text-animation</title> 8 <style> 9 html,body { 10 height: 100%; 11 margin: 0; 12 padding: 0; 13 } 14 body {display: flex;justify-content: center;align-items: center;background-color: #333;} /*用flex布局让div上下左右居中对齐*/ 15 h1 { 16 color: white; /*字体颜色*/ 17 display: inline-block; /

使用JQuery的动态罗盘时钟

时光怂恿深爱的人放手 提交于 2020-04-02 17:20:12
感谢参考原文- http://bjbsair.com/2020-04-01/tech-info/18510.html 惯例,先来效果图 Index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>动态时钟</title> <meta > <script src="js/jquery-1.10.2.js"></script> <script src="js/test.js"></script> <script src="js/common.js"></script> <script src="js/config.js"></script> </head> <style> * { margin: 0; padding: 0; } body { background-attachment: fixed; color: #F5F4F6; font-size: 12px; font-weight: bold; overflow: hidden; width: 1000px; height: 900px; font-family: "微软雅黑"; } audio { position: absolute;

使用JQuery的动态罗盘时钟

旧巷老猫 提交于 2020-04-02 17:09:09
感谢参考原文- http://bjbsair.com/2020-04-01/tech-info/18510.html 惯例,先来效果图 Index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>动态时钟</title> <meta > <script src="js/jquery-1.10.2.js"></script> <script src="js/test.js"></script> <script src="js/common.js"></script> <script src="js/config.js"></script> </head> <style> * { margin: 0; padding: 0; } body { background-attachment: fixed; color: #F5F4F6; font-size: 12px; font-weight: bold; overflow: hidden; width: 1000px; height: 900px; font-family: "微软雅黑"; } audio { position: absolute;

『科学计算』科学绘图库matplotlib学习之绘制动画

丶灬走出姿态 提交于 2020-04-02 07:32:33
基础 1.matplotlib绘图函数接收两个等长list,第一个作为集合x坐标,第二个作为集合y坐标 2.基本函数: animation.FuncAnimation(fig, update_point,data) fig是画布 update是绘画函数需自己定义,需要一个参数,会自动接收data,需要返回plt.plot对象,描述比较费解,看例子就好 data种类很多,包括总帧数(例1)、当前帧数(即不设定data的默认参数,例2)、返回迭代器的函数(例3)、list(作业2) frames=200 总帧数(非update参数) interval=20 帧间隔(毫秒) 示例代码 简单调用帧数绘图 from matplotlib import pyplot as plt import matplotlib.animation as animation import numpy as np def update_point(num): fig_points.set_data(data[:, 0:num]) return fig_points, fig1 = plt.figure() num_point = 50 data = np.random.rand(2, num_point) fig_points, = plt.plot([], [], 'ro') plt.xlim(0, 1)

蚂蚁庄园

↘锁芯ラ 提交于 2020-04-02 05:11:26
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=3, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <title>chick</title> <style> html{min-width:320px;overflow-x:hidden} body,html{height:100%;line-height:1;-webkit-user-select:none;//禁止用户复制页面文本 -webkit-touch-callout:none;-webkit-overflow-scrolling:touch;//ios滚动效果 -webkit-font-smoothing:antialiased;//mac下字体 -webkit-tap-highlight-color:rgba(242,137,76,.05);://a标签点击高亮效果} article,aside,blockquote

Android Animation学习笔记

泄露秘密 提交于 2020-03-31 16:30:13
原文地址: http://www.cnblogs.com/feisky/archive/2010/01/11/1644482.html 关于动画的实现,Android提供了Animation,在Android SDK介绍了2种Animation模式: 1. Tween Animation:通过对场景里的对象不断做图像变换(平移、缩放、旋转)产生动画效果,即是一种渐变动画; 2. Frame Animation:顺序播放事先做好的图像,是一种画面转换动画。 动画类型 下面先来看看Android提供的动画类型。Android的animation由四种类型组成 在XML文件中: alpha 渐变透明度动画效果 scale 渐变尺寸伸缩动画效果 translate 画面转换位置移动动画效果 rotate 画面转移旋转动画效果 在Java 源码中定义了相应的类,可以使用这些类的方法来获取和操作相应的属性: AlphaAnimation渐变透明度动画效果 ScaleAnimation渐变尺寸伸缩动画效果 TranslateAnimation画面转换位置移动动画效果 RotateAnimation画面转移旋转动画效果 Tween Animation 一个tween动画将对视图对象中的内容进行一系列简单的转换(位置,大小,旋转,透明性)。如果你有一个文本视图对象,你可以移动它,旋转它

Core Animation之多种动画效果

偶尔善良 提交于 2020-03-27 10:05:07
前面介绍了Core Animation基础知识,还有CALayer的简单使用,最终还是有要动画的滴,这里列出几个动画效果,参考下能加深对Core Animation的认识和理解 1、把图片移到右下角变小透明 使用CAAnimationGroup叠加动画效果,就是下面按钮《把图片移到右下角变小透明》描述的效果: 、 上面三个图是动画的三个状态,实现代码如下: [cpp] view plain copy - ( void)viewDidLoad { [super viewDidLoad]; self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@ "snaguosha.png"]]; self.imageView.frame = CGRectMake(10, 10, 128, 192); [self.view addSubview:self.imageView]; } [cpp] view plain copy - (IBAction)tranAction:(id)sender { CGPoint fromPoint = self.imageView.center; //路径曲线 UIBezierPath *movePath = [UIBezierPath bezierPath];

Animation inside DataTrigger won't run a second time

自闭症网瘾萝莉.ら 提交于 2020-03-26 08:04:13
问题 This is the code: <Grid> <Ellipse Fill="Turquoise" HorizontalAlignment="Left" Height="100" Stroke="Black" VerticalAlignment="Top" Width="100"> <Ellipse.Style> <Style TargetType="Ellipse"> <Style.Setters> <Setter Property="Ellipse.RenderTransform"> <Setter.Value> <TranslateTransform X="0" Y="50"/> </Setter.Value> </Setter> </Style.Setters> <Style.Triggers> <DataTrigger Binding="{Binding ElementName=rectRight, Path=IsMouseOver}" Value="True"> <DataTrigger.EnterActions> <BeginStoryboard>