css3 - css做动画效果
问题描述

把红色框内做成那种来回动画效果怎么做啊?
问题解答
回答1:<!DOCTYPE html><html><head><style> p{ width:100px; height:100px; background:red; position:relative; animation:mymove 1s infinite; -moz-animation:mymove 1s infinite; /* Firefox */ -webkit-animation:mymove 1s infinite; /* Safari and Chrome */ -o-animation:mymove 1s infinite; /* Opera */ animation-direction: alternate;}@keyframes mymove{ from {left:0px;} to {left:200px;}}@-moz-keyframes mymove /* Firefox */{ from {left:0px;} to {left:200px;}}@-webkit-keyframes mymove /* Safari and Chrome */{ from {left:0px;} to {left:200px;}}@-o-keyframes mymove /* Opera */{ from {left:0px;} to {left:200px;}}</style></head><body><p></p></body></html>
运行一下上面的代码,改于w3school。
链接为:http://www.w3school.com.cn/cs...
回答2:给你个链接 自己对着改参数
回答3:给那个三角图片 摆好位置后, 用类去控制动作。
比如
.move { -webkit-animation-name:’example’; // other code} @-webkit-keyframes ’example’ { 0% {-webkit-transform: translateX(0); } 50% { -webkit-transform: translateX(100px); } 100% { -webkit-transform: translateX(0); } } // 补充说明: -webkit-animation-name:’xxx’;/*动画属性名,也就是我们前面keyframes定义的动画名*/ -webkit-animation-duration: 10s;/*动画持续时间*/ -webkit-animation-timing-function: ease-in-out; /*动画频率,和transition-timing-function是一样的*/ -webkit-animation-delay: 2s;/*动画延迟时间*/ -webkit-animation-iteration-count: 10;/*定义循环资料,infinite为无限次*/ -webkit-animation-direction: alternate;/*定义动画方式* 回答4:
css3的动画效果主要是通过过渡来实现的,用animate来定义一个补间动画,浏览器会自动根据设置的时间来进行渲染。楼上两位大神的代码已经做得很完善了,具体效果题主可以自己根据需要修改
相关文章:
1. 如何解决docker宿主机无法访问容器中的服务?2. javascript - 我这个页面的main的盒模型为什么把header的模型空间也包括了。3. Android-Studio 新建项目 Missing styles4. php为什么是源程序显示?5. 老师,flex-shrink: 1; 按视频操作,不会自动缩放6. golang - 用IDE看docker源码时的小问题7. debian - docker依赖的aufs-tools源码哪里可以找到啊?8. docker容器呢SSH为什么连不通呢?9. 在windows下安装docker Toolbox 启动Docker Quickstart Terminal 失败!10. docker api 开发的端口怎么获取?

网公网安备