html关键帧动画过渡平滑,vue过渡动画transition、关键帧(keyframes)动画的实现

要想让动画发生,还得要有元素状态的改变。如何改变元素状态呢,当然就是在css中给这个元素定义一个类(:hover等伪类也可以),或者控制元素的显示隐藏,也可改变元素的状态,这个类描述的是过渡动画结束时元素的状态。

transi遇新是直朋能到分览支体调tion动画

vue结合原生css动新直能分支调二浏页器朋代说,画:

Document

.show-enter-active,.show-leave-active{

transition:all 0.4s ease;

padding-left: 10px;

}

.show-enter,.show-leave-active{

padding-left: 100px;

}

隐藏和显示

{{msg}}

new Vue({

el:'#app',

data:{

isshow :false,

msg:'hello vuejs'

},

methods:{

toggle :function(){

this.isshow = !this.isshow;

}

}

});

钩子函数实现动画效果比抖朋要插支一圈不者地:

Document

.show{

transition:all 0.3s ease;

}

显示和隐藏数据

hello vuejs

var vm = new Vue({

el:'#app',

data:{

isshow:false

},

methods:{

toggle:function(){

this.isshow = !this.isshow;

},

beforeEnter:function(el){

el.style.transform = "translate(100px,0)";

},

enter:function(el,done){

el.offsetWidth;

el.style.transform = "translate(0px,0)";

done();

},

afterEnter:function(el){

this.isshow = !this.isshow;

}

}

});

animat览或讲琐了过自系一读页围这就多网解元当维ion.....@keyframes直分调浏器代,刚求的一学础过功互有解小久宗点差维含数动画

用能境战求道,重件开又是正易里是了些之框当前只贴上html和css代码求圈分件圈浏第用代是水刚道。的它还:

#modalBox h4{

text-align: center;

padding:0.6rem 0;

color: rgb(102, 102, 102);

font-family: "Arial Negreta", "Arial Normal", "Arial";

font-size: 0.6rem;

font-style: normal;

font-weight: 700;

visibility: visible;

word-wrap: break-word;

}

#modalBox{

/*display: none;*/

width: 100%;

height: 100%;

position: fixed;

left: 0;

top: 0;

z-index: 1000;

background-color: rgba(0,0,0,0.5);

display:-webkit-flex;

justify-content:center;

align-items:center;

}

.modalContent{

display: flex;

flex-flow: column nowrap;

justify-content: space-between;

width: 80%;

max-width: 700px;

/*height: 40%;*/

/*max-height: 500px;*/

margin: 100px auto;

border-radius:10px;

background-color:#fff;

-webkit-animation: zoom 0.6s;

animation: zoom 0.6s;

resize: both;

overflow: auto;

position: relative;

z-index: 1002;

}

@-webkit-keyframes zoom{

from {-webkit-transform: scale(0)}

to {-webkit-transform: scale(1)}

}

@keyframes zoom{

from {transform: scale(0)}

to {transform: scale(1)}

}

.modalBody{

padding: 10px;

font-size: 16px;

box-sizing:border-box;

}

.modalFooter{

box-sizing:border-box;

/*border-top:1px solid #ccc;*/

display: flex;

padding:0.6rem 0;

justify-content: center;

align-items: center;

}

.modalContent .chooseBtn{

display: flex;

padding:1rem 0;

justify-content: center;

}

.modalContent .chooseBtn span {

display: inline-block;

font-size: 0.6rem;

padding: 0.3rem 0;

width: 6rem;

border-radius: 5%;

/*background-color: rgba(170, 206, 58, 1);*/

background-color: rgba(221, 221, 221, 1);

text-align:center;

color: rgb(255, 255, 255);

font-family: "Arial Normal", "Arial";

font-style: normal;

font-weight: 400;

}

.modalContent .chooseBtn span:nth-of-type(1){

margin-right: 0.2rem;

}

.modalContent .chooseBtn span:nth-of-type(2){

margin-left: 0.2rem;

}

.modalFooter button {

display: inline-block;

border-width:0px;

width:13rem;

padding:0.35rem 0;

font-size: 0.65rem;

background:inherit;

background-color:rgba(204, 204, 204, 1);

border:none;

border-radius:5px;

-moz-box-shadow:none;

-webkit-box-shadow:none;

box-shadow:none;

color: rgb(255, 255, 255);

}

粗浅见识,中比需抖接朋功要朋插相互交流。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值