html鼠标滑过播放动画,css3鼠标滑过动画

本实例共有五个鼠标滑过的动画效果,但其实原理都是差不多。第一个是多加了一个空白的标签,来显示那个遮罩的三角形;第二,三,四都是对却是用border来生成的遮罩,至于第五个效果就比较复杂,不过原理都是一样的,实际应用也不需要那么复杂。所以只需把前面四个简单的学会了,第五个就当做欣赏吧,扩大自己的视野,以后举一反三的机会多的是。说到底,transition的动画变换来变换去,都是那么几个属性,关键在于对基本属性的把握及对动画效果的设计,多看点效果积累点,以后也可以做到得心应手。

css主要代码:

.view {

width: 300px;

height: 200px;

margin: 10px;

float: left;

border: 5px solid #fff;

overflow: hidden;

position: relative;

text-align: center;

box-shadow: 0px 0px 5px #aaa;

cursor: default;

}

.view .mask, .view .content {

width: 300px;

height: 200px;

position: absolute;

overflow: hidden;

top: 0;

left: 0;

}

.view img {

display: block;

position: relative;

}

.view a.info {

background:url(../img/link.png) center no-repeat;

display: inline-block;

text-decoration: none;

padding:0;

text-indent:-9999px;

width:20px;

height:20px;

}

/*demo1*/

.effect img {

opacity:1;

transform:scale(1,1);

transition: all 0.2s ease-in;

}

.effect .mask {

opacity:0;

overflow:visible;

border-color:rgba(0,0,0,0.7) transparent transparent transparent;

border-style:solid;

border-width:150px;

width:0;

height:0;

transform:translateY(-125px);

transition: transform 0.2s 0.1s ease-out, opacity 0.3s ease-in-out;

}

.effect a.info {

opacity:0;

transform:translateY(-125px);

transition: transform 0.3s ease-in, opacity 0.1s ease-in-out;

}

.effect:hover img {

opacity:0.7;

transform:scale(2,2);

}

.effect:hover .mask {

opacity: 1;

transform: translateY(0px);

}

.effect:hover a.info {

opacity:1;

transform:translateY(100px);

}

/*demo2*/

.second-effect .mask {

opacity: 0;

overflow:visible;

border:0px solid rgba(0,0,0,0.7);

box-sizing:border-box;

transition: all 0.4s ease-in-out;

}

.second-effect a.info {

position:relative;

top:-10px;

opacity:0;

transform:scale(0,0);

transition: transform 0.2s 0.1s ease-in, opacity 0.1s ease-in-out;

}

.second-effect:hover .mask {

opacity: 1;

border:100px solid rgba(0,0,0,0.7);

}

.second-effect:hover a.info {

opacity:1;

transform:scale(1,1);

transition-delay:0.3s;

}

/*demo3*/

.third-effect .mask {

opacity: 0;

overflow:visible;

border:100px solid rgba(0,0,0,0.7);

box-sizing:border-box;

transition: all 0.4s ease-in-out;

}

.third-effect a.info {

position:relative;

top:-10px; /* Center the link */

opacity: 0;

transition: opacity 0.5s 0s ease-in-out;

}

.third-effect:hover .mask {

opacity: 1;

border:100px solid rgba(0,0,0,0.7);

}

.third-effect:hover a.info {

opacity:1;

transition-delay: 0.3s;

}

/*demo4*/

.fourth-effect .mask {

position:absolute; /* Center the mask */

top:50px;

left:100px;

cursor:pointer;

border-radius: 50px;

border-width: 50px;

display: inline-block;

height: 100px;

width: 100px;

border: 50px solid rgba(0, 0, 0, 0.7);

box-sizing:border-box;

opacity:1;

visibility:visible;

transform:scale(4);

transition:all 0.3s ease-in-out;

}

.fourth-effect:hover .mask {

opacity: 0;

border:0px solid rgba(0,0,0,0.7);

visibility:hidden;

}

/*demo5*/

.fifth-effect img {

opacity:0.2;

transition: all 0.3s ease-in;

}

.fifth-effect .mask {

cursor:pointer;

opacity:1;

visibility:visible;

border:100px solid rgba(0,0,0,0.7);

box-sizing:border-box;

transition: all 0.4s cubic-bezier(0.940, 0.850, 0.100, 0.620);

}

.fifth-effect:hover .mask {

border:0px double rgba(0,0,0,0.7);

opacity:0;

visibility:hidden;

}

.fifth-effect:hover img {

opacity:1;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值