仿网易nec首页动画效果(实现原理+代码)
建站知识 2021-07-03 08:43www.168986.cn长沙网站建设
仿网页nec首页动画效果
nec链接http://nec.ease./
,介绍animation
animation检索或设置对象所应用的动画特效。
animation由“keyframes”这个属性来实现这样的效果。
keyframes具有其自己的语法规则,他的命名是由"@keyframes"开头,后面紧接着是这个“动画的名称”加上一对花括号“{}”,括号中就是一些不间段样式规则,有点像我们css的样式写法一样。
关于animation属性介绍
animation-name检索或设置对象所应用的动画名称
animation-duration检索或设置对象动画的持续时间
animation-timing-function检索或设置对象动画的过渡类型
animation-delay检索或设置对象动画延迟的时间
animation-iteration-count检索或设置对象动画的循环次数
animation-direction检索或设置对象动画在循环中是否反向运动
animation-play-state检索或设置对象动画的状态。w3c正考虑是否将该属性移除,因为动画的状态可以通过其它的方式实现,比如重设样式
nec动画实现原理
采用三层背景层、气泡层、文字镂空层。气泡层通过animation属性实现了运动效果。
html结构
<div class="kbanner">
<div class="knecbg knecone"></div>
<div class="knecbg knectwo">
<i></i>
<i></i>
<i></i>
<i></i>
<i></i>
</div>
<div class="knecbg knecthree"></div>
</div>
css样式
.kbanner{
position: relative;
width: 856px;
height: 366px;
background: url(http://images.blogs./blogs_/kuikui/354173/o_banner1.jpg) center no-repeat;
}
.knecbg{
position: absolute;
left: 150px;
: 77px;
width: 487px;
height: 186px;
overflow: hidden;
}
.knecone{
background: url(//img.jbzj./file_images/article/201306/o_pao.png) left no-repeat;
z-index: 1;
}
.knectwo{
z-index: 2;
}
.knecthree{
background: url(//img.jbzj./file_images/article/201306/o_pao.png) left bottom no-repeat;
z-index: 3;
}
.knectwo i{
position: absolute;
display: block;
: -50px;
width: 53px;
height: 56px;
overflow: hidden;
background: url(//img.jbzj./file_images/article/201306/o_pao.png) no-repeat -9999px -9999px;
-webkit-animation: paoi 7s 2s infinite;
-moz-animation: paoi 7s 2s infinite;
-ms-animation: paoi 7s 2s infinite;
animation: paoi 7s 2s infinite;
}
.knectwo i:nth-child(1){
left: 25px;
-webkit-animation-delay: 3s;
-moz-animation-delay: 3s;
-ms-animation-delay: 3s;
animation-delay: 3s;
background-position: -507px 0;
}
.knectwo i:nth-child(2){
left: 85px;
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-ms-animation-delay: 6s;
animation-delay: 6s;
background-position: -507px -64px;
}
.knectwo i:nth-child(3){
left: 190px;
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
-ms-animation-delay: 4s;
animation-delay: 4s;
background-position: -507px -140px;
}
.knectwo i:nth-child(4){
left: 285px;
-webkit-animation-delay: 8s;
-moz-animation-delay: 8s;
-ms-animation-delay: 8s;
animation-delay: 8s;
background-position: -507px 0;
}
.knectwo i:nth-child(5){
left: 400px;
-webkit-animation-delay: 5s;
-moz-animation-delay: 5s;
-ms-animation-delay: 5s;
animation-delay: 5s;
background-position: -507px 0;
}
@-webkit-keyframes paoi {
% {
:186px;
}
% {
:-56px;
}
}@-moz-keyframes paoi {
% {
:186px;
}
% {
:-56px;
}
}@-ms-keyframes paoi {
% {
:186px;
}
% {
:-56px;
}
}@keyframes paoi {
% {
:186px;
}
% {
:-56px;
}
nec动画效果
提示您可以先修改部分代码再运行
nec链接http://nec.ease./
,介绍animation
animation检索或设置对象所应用的动画特效。
animation由“keyframes”这个属性来实现这样的效果。
keyframes具有其自己的语法规则,他的命名是由"@keyframes"开头,后面紧接着是这个“动画的名称”加上一对花括号“{}”,括号中就是一些不间段样式规则,有点像我们css的样式写法一样。
关于animation属性介绍
animation-name检索或设置对象所应用的动画名称
animation-duration检索或设置对象动画的持续时间
animation-timing-function检索或设置对象动画的过渡类型
animation-delay检索或设置对象动画延迟的时间
animation-iteration-count检索或设置对象动画的循环次数
animation-direction检索或设置对象动画在循环中是否反向运动
animation-play-state检索或设置对象动画的状态。w3c正考虑是否将该属性移除,因为动画的状态可以通过其它的方式实现,比如重设样式
nec动画实现原理
采用三层背景层、气泡层、文字镂空层。气泡层通过animation属性实现了运动效果。
html结构
复制代码
代码如下:<div class="kbanner">
<div class="knecbg knecone"></div>
<div class="knecbg knectwo">
<i></i>
<i></i>
<i></i>
<i></i>
<i></i>
</div>
<div class="knecbg knecthree"></div>
</div>
css样式
复制代码
代码如下:.kbanner{
position: relative;
width: 856px;
height: 366px;
background: url(http://images.blogs./blogs_/kuikui/354173/o_banner1.jpg) center no-repeat;
}
.knecbg{
position: absolute;
left: 150px;
: 77px;
width: 487px;
height: 186px;
overflow: hidden;
}
.knecone{
background: url(//img.jbzj./file_images/article/201306/o_pao.png) left no-repeat;
z-index: 1;
}
.knectwo{
z-index: 2;
}
.knecthree{
background: url(//img.jbzj./file_images/article/201306/o_pao.png) left bottom no-repeat;
z-index: 3;
}
.knectwo i{
position: absolute;
display: block;
: -50px;
width: 53px;
height: 56px;
overflow: hidden;
background: url(//img.jbzj./file_images/article/201306/o_pao.png) no-repeat -9999px -9999px;
-webkit-animation: paoi 7s 2s infinite;
-moz-animation: paoi 7s 2s infinite;
-ms-animation: paoi 7s 2s infinite;
animation: paoi 7s 2s infinite;
}
.knectwo i:nth-child(1){
left: 25px;
-webkit-animation-delay: 3s;
-moz-animation-delay: 3s;
-ms-animation-delay: 3s;
animation-delay: 3s;
background-position: -507px 0;
}
.knectwo i:nth-child(2){
left: 85px;
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-ms-animation-delay: 6s;
animation-delay: 6s;
background-position: -507px -64px;
}
.knectwo i:nth-child(3){
left: 190px;
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
-ms-animation-delay: 4s;
animation-delay: 4s;
background-position: -507px -140px;
}
.knectwo i:nth-child(4){
left: 285px;
-webkit-animation-delay: 8s;
-moz-animation-delay: 8s;
-ms-animation-delay: 8s;
animation-delay: 8s;
background-position: -507px 0;
}
.knectwo i:nth-child(5){
left: 400px;
-webkit-animation-delay: 5s;
-moz-animation-delay: 5s;
-ms-animation-delay: 5s;
animation-delay: 5s;
background-position: -507px 0;
}
@-webkit-keyframes paoi {
% {
:186px;
}
% {
:-56px;
}
}@-moz-keyframes paoi {
% {
:186px;
}
% {
:-56px;
}
}@-ms-keyframes paoi {
% {
:186px;
}
% {
:-56px;
}
}@keyframes paoi {
% {
:186px;
}
% {
:-56px;
}
nec动画效果
提示您可以先修改部分代码再运行
长沙网站设计
- 如何进行东阳SEO关键词优化?
- 边坝哪有关键词排名优化:提升你的网站流量与
- 安国百度优化服务:提升您的在线可见性
- 阜康新手做SEO怎么做
- 山西seo网站排名关键词优化:提升您网站曝光率
- 临沂seo网站排名关键词优化:提高你的网站可见
- 广西SEO网站推广怎样付费比较合理
- 双辽SEO网站推广:提升你的网站可见性与流量
- 辽宁企业网站优化购买方式有哪些
- 提升宝清百度SEO排名的实用技巧与策略
- 静宁百度SEO排名:提升您网站曝光率的关键策略
- 彭州百度SEO排名的提升策略和实施指南
- 广南百度关键词SEO:提升网站排名的关键策略
- 辽宁关键词优化怎么做论坛营销
- 吉林百度seo排名如何做到让用户满意
- 内黄百度优化服务:提升在线可见性的关键