通过CSS3属性值的变化实现动画效果+触发这些动画产生交互
css3过渡
transition
兼容性:IE10+
transition: none | all | property
默认为none
all 表示所有属性过渡
property 指定属性值,如color opacity
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body{
margin:0 auto;
background:#abcdef;
}
.box{
width:700px;
height:700px;
margin:0 auto;
background:url(source/pic.png) center no-repeat;
cursor: pointer;
-webkit-transform:rotate(0deg);
-moz-transform:rotate(0deg);
-ms-transform:rotate(0deg);
-o-transform:rotate(0deg);
transform:rotate(0deg);
-webkit-transition-property:transform;
-moz-transition-property:transform;
-ms-transition-property:transform;
-o-transition-property:transform;
transition-property:transform;
}
.box:hover{
-webkit-transform:rotate(180deg);
-moz-transform:rotate(180deg);
-ms-transform:rotate(180deg);
-o-transform:rotate(180deg);
transform:rotate(180deg);
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>

transition-duration 动画持续时间
transition-timing-function: linear | ease | ease-in | ease-out | ease-in-out
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body{
margin:0 auto;
background:#abcdef;
}
.box{
width:700px;
height:700px;
margin:0 auto;
background:url(source/pic.png) center no-repeat;
cursor: pointer;
-webkit-transform:rotate(0deg);
-moz-transform:rotate(0deg);
-ms-transform:rotate(0deg);
-o-transform:rotate(0deg);
transform:rotate(0deg);
-webkit-transition-property:transform;
-moz-transition-property:transform;
-ms-transition-property:transform;
-o-transition-property:transform;
transition-property:transform;
-webkit-transition-duration:2s;
-moz-transition-duration:2s;
-ms-transition-duration:2s;
-o-transition-duration:2s;
transition-duration:2s;
-webkit-transition-timing-function:linear;/*线性*/
-moz-transition-timing-function:linear;
-ms-transition-timing-function:linear;
-o-transition-timing-function:linear;
transition-timing-function:linear;
-webkit-transition-timing-function:ease;/*平滑*/
-moz-transition-timing-function:ease;
-ms-transition-timing-function:ease;
-o-transition-timing-function:ease;
transition-timing-function:ease;
-webkit-transition-timing-function:ease-in;/*缓入*/
-moz-transition-timing-function:ease-in;
-ms-transition-timing-function:ease-in;
-o-transition-timing-function:ease-in;
transition-timing-function:ease-in;
-webkit-transition-timing-function:ease-out;/*缓出*/
-moz-transition-timing-function:ease-out;
-ms-transition-timing-function:ease-out;
-o-transition-timing-function:ease-out;
transition-timing-function:ease-out;
-webkit-transition-timing-function:ease-in-out;/*缓入缓出*/
-moz-transition-timing-function:ease-in-out;
-ms-transition-timing-function:ease-in-out;
-o-transition-timing-function:ease-in-out;
transition-timing-function:ease-in-out;
}
.box:hover{
-webkit-transform:rotate(180deg);
-moz-transform:rotate(180deg);
-ms-transform:rotate(180deg);
-o-transform:rotate(180deg);
transform:rotate(180deg);
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>

transition-delay 过渡延迟
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body{
margin:0 auto;
background:#abcdef;
}
.box{
width:700px;
height:700px;
margin:0 auto;
background:url(source/pic.png) center no-repeat;
cursor: pointer;
-webkit-transform:rotate(0deg);
-moz-transform:rotate(0deg);
-ms-transform:rotate(0deg);
-o-transform:rotate(0deg);
transform:rotate(0deg);
-webkit-transition-property:transform;
-moz-transition-property:transform;
-ms-transition-property:transform;
-o-transition-property:transform;
transition-property:transform;
-webkit-transition-duration:2s;
-moz-transition-duration:2s;
-ms-transition-duration:2s;
-o-transition-duration:2s;
transition-duration:2s;
-webkit-transition-timing-function:ease-in-out;/*缓入缓出*/
-moz-transition-timing-function:ease-in-out;
-ms-transition-timing-function:ease-in-out;
-o-transition-timing-function:ease-in-out;
transition-timing-function:ease-in-out;
-webkit-transition-delay:1s;
-moz-transition-delay:1s;
-ms-transition-delay:1s;
-o-transition-delay:1s;
transition-delay:1s;
}
.box:hover{
-webkit-transform:rotate(180deg);
-moz-transform:rotate(180deg);
-ms-transform:rotate(180deg);
-o-transform:rotate(180deg);
transform:rotate(180deg);
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>

transtion简写
transition: property duration timing-function delay
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body{
margin:0 auto;
background:#abcdef;
}
.box{
width:700px;
height:700px;
margin:0 auto;
background:url(source/pic.png) center no-repeat;
cursor: pointer;
-webkit-transform:rotate(0deg);
-moz-transform:rotate(0deg);
-ms-transform:rotate(0deg);
-o-transform:rotate(0deg);
transform:rotate(0deg);
-webkit-transition:transform 2s ease-in-out 1s;
-moz-transition:transform 2s ease-in-out 1s;
-ms-transition:transform 2s ease-in-out 1s;
-o-transition:transform 2s ease-in-out 1s;
transition:transform 2s ease-in-out 1s;
}
.box:hover{
-webkit-transform:rotate(180deg);
-moz-transform:rotate(180deg);
-ms-transform:rotate(180deg);
-o-transform:rotate(180deg);
transform:rotate(180deg);
-webkit-transition:transform 2s ease-in-out 1s;
-moz-transition:transform 2s ease-in-out 1s;
-ms-transition:transform 2s ease-in-out 1s;
-o-transition:transform 2s ease-in-out 1s;
transition:transform 2s ease-in-out 1s;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
通过CSS3属性值的变化实现动画效果+触发这些动画产生交互的更多相关文章
- js 获取和设置css3 属性值的实现方法
众多周知 CSS3 增加了很多属性,在读写的时候就没有原先那么方便了. 如:<div style="left:100px"></div> 只考虑行间样式的话 ...
- javascript动画效果之缓冲动画(修改版)
在编写多块同时触发运动的时候,发现一个BUG, timer = setInterval(show, 30);本来show是一个自定义函数,当设为timer = setInterval(show(one ...
- Android 动画效果 及 自定义动画
1. View动画-透明动画效果2. View动画-旋转动画效果3. View动画-移动动画效果4. View动画-缩放动画效果5. View动画-动画效果混合6. View动画-动画效果侦听7. 自 ...
- Java 给PPT添加动画效果(预设动画/自定义动画)
PPT幻灯片中对形状可设置动画效果,常见的动画效果为内置的固定类型,即动画效果和路径是预先设定好的固定模板,但在设计动画效果时,用户也可以按照自己的喜好自定义动画动作路径.下面,通过Java后端程序代 ...
- 012 Android 动画效果(补间动画) +去掉App默认自带的标题+更改应用的图标
1.介绍 补间动画开发者只需指定动画开始,以及动画结束"关键帧", 而动画变化的"中间帧"则由系统计算并补齐! 2.去掉App的标题 (1)将AndroidMa ...
- jQuery演示10种不同的切换图片列表动画效果以及tab动画演示 2
很常用的一款特效纯CSS完成tab实现5种不同切换对应内容效果 实例预览 下载地址 实例代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ...
- 根据Expander的IsExpanded属性值的变化动态设计Control的size
简要说明: 当Expander 的IsExpanded属性为“True” 时给控件设个尺寸(此处为高度),当为“False”时给控件设另外一个值. 知识点:数据绑定.Style和Trigger < ...
- CSS3属性值之box-shadow
语法: box-shadow:inset x-offset y-offset blur-radius spread-radius color 也就是: 对象选择器 {box-shadow:投影 ...
- Vue中如何监控某个属性值的变化?
比如现在需要监控data中, obj.a 的变化.Vue中监控对象属性的变化你可以这样: deep属性表示深层遍历,但是这么写会监控obj的所有属性变化,并不是我们想要的效果,所以做点修改: 还有一种 ...
随机推荐
- Oracle 11g 单实例静默安装实战记录(linux)
oracle 11g 单实例静默安装 AUTHOR:Oracle_Ran 环境规划: OS Version : Red Hat Enterprise Linux Server release 6.7 ...
- 【WPF学习】第三十四章 资源基础
WPF允许在代码中以及在标记中的各个位置定义资源(和特定的控件.窗口一起定义,或在整个应用程序中定义). 资源具有许多重要的优点,如下所述: 高效.可以通过资源定义对象,并在标记中的多个地方使用.这会 ...
- linux安装mariadb
yum install -y mariadb-server 账号:root 密码:空 本地登录:mysql -u root -p 远程登录:mysql -h 192.168.0.1 -u root - ...
- [Python]获取win平台文件的详细信息
import win32api def getFileProperties(fname): """ 读取给定文件的所有属性, 返回一个字典. ""&q ...
- Codeforces 1065C Make It Equal (差分+贪心)
题意:n个塔,第i个塔由$h_i$个cube组成,每次可以切去某高度h以上的最多k个cube,问你最少切多少次,可以让所有塔高度相等 k>=n, n<=2e5 思路:差分统计每个高度i有的 ...
- HDU4192 Guess the Numbers(表达式计算、栈)
题意: 给你一个带括号.加减.乘的表达式,和n个数$(n\leq 5)$,问你带入这几个数可不可能等于n 思路: 先处理表达式:先将中缀式转化为逆波兰表达式 转换过程需要用到栈,具体过程如下:1)如果 ...
- 1 深入Web请求过程
1.1 B/S网络架构概述 B/S 网络架构从前端到后端都得到了简化,都基于统一的应用层协议HTTP来交互数据,与大多数传统C/S互联网应用程 序采用的长连接的交互模式不同,HTTP采用无状态的短连接 ...
- [教程分享]锐族MP3刷固件教程
转载自我的博客:https://blog.ljyngup.com/archives/163.html/ (废话较多见谅) 在到学校前发现几个月前锐族mp3的固件更新了,赶紧刷了一个,发现网上关于这个售 ...
- 常用命令 find chmod
find path -option [ -print ] [ -exec -ok command ] {} \; find [指定查找目录] [查找规则] [查找 ...
- SpringBoot基础篇-SpringBoot快速入门
SpringBoot基础 学习目标: 能够理解Spring的优缺点 能够理解SpringBoot的特点 能够理解SpringBoot的核心功能 能够搭建SpringBoot的环境 能够完成applic ...