*新闻详情页*/>
序言
本文关键给大伙儿共享的是有关运用CSS3动漫完成圆圈由小增大向扩散的实际效果案例,文中涉及到到 CSS3 的动漫(animation)、2D 变换(transform: scale)
css3中新增了1个animation的特性,该特性相近于建立1个animation目标
如:animation: bounce 2.0s infinite ease-in-out;
animation有下列几个主要参数:
CSS 3 中2D变换的完成用到两个特性:
静态数据实际效果图:
实际如编码所示:
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf⑻" /> <title>无题目文本文档</title> <style> @keyframes warn { 0% { transform: scale(0); opacity: 0.0; } 25% { transform: scale(0); opacity: 0.1; } 50% { transform: scale(0.1); opacity: 0.3; } 75% { transform: scale(0.5); opacity: 0.5; } 100% { transform: scale(1); opacity: 0.0; } } @-webkit-keyframes "warn" { 0% { -webkit-transform: scale(0); opacity: 0.0; } 25% { -webkit-transform: scale(0); opacity: 0.1; } 50% { -webkit-transform: scale(0.1); opacity: 0.3; } 75% { -webkit-transform: scale(0.5); opacity: 0.5; } 100% { -webkit-transform: scale(1); opacity: 0.0; } } .container { position: relative; width: 40px; height: 40px; border: 1px solid #000; } /* 维持尺寸不会改变的小圆圈 */ .dot { position: absolute; width: 6px; height: 6px; left: 15px; top: 15px; -webkit-border-radius: 20px; -moz-border-radius: 20px; border: 2px solid red; border-radius: 20px; z-index: 2; } /* 造成动漫(向扩散增大)的圆圈 */ .pulse { position: absolute; width: 24px; height: 24px; left: 2px; top: 2px; border: 6px solid red; -webkit-border-radius: 30px; -moz-border-radius: 30px; border-radius: 30px; z-index: 1; opacity: 0; -webkit-animation: warn 3s ease-out; -moz-animation: warn 3s ease-out; animation: warn 3s ease-out; -webkit-animation-iteration-count: infinite; -moz-animation-iteration-count: infinite; animation-iteration-count: infinite; } </style> </head> <body> <div class="container"> <div class="dot"></div> <div class="pulse"></div> </div> </body> </html>
总结
以上便是这篇文章内容的所有內容了,期待本文的內容对大伙儿的学习培训或工作中具备1定的参照学习培训使用价值,假如有疑惑大伙儿能够留言沟通交流,感谢大伙儿对脚本制作之家的适用。
Copyright © 2002-2020 如何制作微信小游戏_微信游戏小程序_公众号游戏_h5小游戏模板_小程序游戏源码 版权所有 (网站地图) 粤ICP备10235580号