赞
踩
在关键帧(Keyframes)中动态设置父组件的width和height,实现组件变大缩小。子组件设置scale属性使父子组件同时缩放,再设置opacity实现父子组件的显示与隐藏。
<!-- xxx.hml --> <div class="container"> <div class="fade"> <text>fading away</text> </div> <div class="bigger"> <text>getting bigger</text> </div> </div>
/* xxx.css */ .container { background-color:#F1F3F5; display: flex; justify-content: center; align-items: center; flex-direction: column; width: 100%; height: 100%; } .fade{ width: 30%; height: 200px; left: 35%; top: 25%; position: absolute; animation: 2s change infinite friction; } .bigger{ width: 20%; height: 100px; background-color: blue; animation: 2s change1 infinite linear-out-slow-in; } text{ width: 100%; height: 100%; text-align: center; color: white; font-size:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。