分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

css心跳动画

发布时间:2023-09-06 02:12责任编辑:沈小雨关键词:动画

1、图片无限放大缩小,类似心跳

css如下

 ??@keyframes scaleDraw { ?/*定义关键帧、scaleDrew关键帧名称*/ ???????????0%{ ???????????????transform: scale(1); ?/*开始为原始大小*/ ???????????} ???????????25%{ ???????????????transform: scale(1.6); /*放大1.1倍*/ ???????????} ???????????50%{ ???????????????transform: scale(1); ???????????} ???????????75%{ ???????????????transform: scale(1.6); ???????????} ???????}

元素css中写上

-webkit-animation: scaleDraw 5s ease-in-out infinite;

2、元素或者图片,类似波纹扩散动画无限循环

html部分 <div class="parent"> ????????<img src="...." alt=""> ????????<span></span> ????????<span></span> ????</div>
css部分    .parent{ ??????????position: relative; ??????????width: 200px; ??????????height: 200px; ??????} ??????.parent img{ ??????????width: 200px; ??????????height: 200px; ??????????z-index: 0; ??????} ???????@keyframes biging{ ???????????0%{ ???????????????transform: scale(1); ???????????????opacity: 0.5; ?????????????} ???????????50%{ ???????????????transform: scale(1.5); ?????????????????opacity: 0; ??/*圆形放大的同时,透明度逐渐减小为0*/ ???????????} ???????????100%{ ???????????????transform: scale(1); ???????????????opacity: 0.5; ???????????} ???????} ???????.parent span{ ???????????position: absolute; ???????????width: 100px; ???????????height: 100px; ???????????left: 0; ???????????bottom: 0; ???????????background: #fff; ???????????border-radius: 50%; ???????????-webkit-animation: biging 3s linear infinite; ???????????z-index: -1; ???????} ???????.parent span:nth-child(2){ ???????????-webkit-animation-delay: 2s; /*第二个span动画需要延迟2秒*/ ???????}

3、制作动画相册

重叠的图片控制一张的透明度的无限循环变化

@keyframes picOpacit{ ???????????0%{ ???????????????opacity: 0; ???????????} ???????????50%{ ???????????????opacity: 1; ???????????} ???????????100%{ ???????????????opacity: 0; ???????????} ???????} ???????.pic2{ ???????????position: absolute; ???????????width: 100px; ???????????height: 100px; ???????????left: 0; ???????????top: 0; ???????????-webkit-animation: picOpacity 3s ease-in-out infinite; ???????}

 4、加载的旋转动画

/*加载中动画*/@keyframes rotate{ ???0%{ ???????transform:rotate(0deg); ???????-ms-transform:rotate(0deg); ????/* IE 9 */ ???????-moz-transform:rotate(0deg); ????/* Firefox */ ???????-webkit-transform:rotate(0deg); /* Safari oí Chrome */ ???????-o-transform:rotate(0deg); ???} ???100%{ ???????transform:rotate(360deg); ???????-ms-transform:rotate(360deg); ????/* IE 9 */ ???????-moz-transform:rotate(360deg); ????/* Firefox */ ???????-webkit-transform:rotate(360deg); /* Safari oí Chrome */ ???????-o-transform:rotate(360deg); ???}}.notLoad img{ ???position: relative; ???top: .05rem; ???margin-right: 3px; ???width: .32rem; ???height: .32rem; ???-webkit-animation: rotate 2s ease-in-out infinite;}

css心跳动画

原文地址:https://www.cnblogs.com/gopark/p/9551462.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved