当前位置: 首页 > news >正文

Vue3中实现原生CSS完成圆形按钮点击粒子效果和定点旋转动画

效果:

源码:

<script setup>
import { ElMessage } from "element-plus";
const isClick = () => {ElMessage.success('Clicked');
};
</script><template><button @click="isClick" class="button"><el-icon><Refresh /></el-icon></button>
</template><style scoped>
.button {display: inline-block;background-color: #07c160;color: #fff;border-radius: 4px;border: none;cursor: pointer;position: relative;box-shadow: 0 2px 25px rgba(233, 30, 99, 0.5);outline: 0;transition: transform ease-in 0.1s, background-color ease-in 0.1s, box-shadow ease-in 0.25s;width: 24px;height: 24px;border-radius: 12px;left:15px;top:15px;padding: 3px;animation: tada 1s;
}.button::before {position: absolute;content: '';left: -2em;right: -2em;top: -2em;bottom: -2em;pointer-events: none;transition: ease-in-out .5s;background-repeat: no-repeat;background-image: radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%),radial-gradient(circle, #03ebf3 20%, transparent 20%);background-size: 10% 10%, 20% 20%, 15% 15%, 20% 20%, 18% 18%, 10% 10%, 15% 15%, 10% 10%, 18% 18%,15% 15%, 20% 20%, 18% 18%, 20% 20%, 15% 15%, 10% 10%, 20% 20%;background-position: 18% 40%, 20% 31%, 30% 30%, 40% 30%, 50% 30%, 57% 30%, 65% 30%, 80% 32%, 15% 60%,83% 60%, 18% 70%, 25% 70%, 41% 70%, 50% 70%, 64% 70%, 80% 71%;animation: bubbles ease-in-out .75s forwards;
}.button:active {transform: scale(0.95);background-color: #03ebf3;box-shadow: 0 2px 25px rgba(233, 30, 99, 0.5);
}.button:active::before {animation: none;background-size: 0;
}/* 动画效果 */
@keyframes tada {from {transform: scale3d(1, 1, 1);}10%, 20% {transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -5deg);}30%, 50%, 70%, 90% {transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 5deg);}40%, 60%, 80% {transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -5deg);}to {transform: scale3d(1, 1, 1);}
}@keyframes bubbles {0% {background-position: 18% 40%, 20% 31%, 30% 30%, 40% 30%, 50% 30%, 57% 30%, 65% 30%, 80% 32%, 15% 60%,83% 60%, 18% 70%, 25% 70%, 41% 70%, 50% 70%, 64% 70%, 80% 71%;}50% {background-position: 10% 44%, 0% 20%, 15% 5%, 30% 0%, 42% 0%, 62% -2%, 75% 0%, 95% -2%, 0% 80%,95% 55%, 7% 100%, 24% 100%, 41% 100%, 55% 95%, 68% 96%, 95% 100%;}100% {background-position: 5% 44%, -5% 20%, 7% 5%, 23% 0%, 37% 0, 58% -2%, 80% 0%, 100% -2%, -5% 80%,100% 55%, 2% 100%, 23% 100%, 42% 100%, 60% 95%, 70% 96%, 100% 100%;background-size: 0% 0%;}
}
</style>

http://www.lryc.cn/news/478525.html

相关文章:

  • 百度网盘 服务器开小差了
  • 数据分析师招聘要求
  • 【C语言】实战-力扣题库:回文链表
  • Centos安装Minio
  • 二叉树的基本概念和底层实现
  • GIF图片格式详解(三)
  • 类和对象相关题
  • Word大珩助手:超大数字怎么读?35位数字?69位数字?
  • 阿里云k8s-master部署CNI网络插件遇到的问题
  • 【LwIP源码学习4】主线程tcpip_thread
  • 求猫用宠物空气净化器推荐,有没有吸毛强、噪音小的产品
  • pycharm中python控制台出现CommandNotFoundError: No command ‘conda run‘.
  • 架构师备考-架构基本概念
  • 信奥赛C++知识点
  • 高并发内存池扩展 -- 处理大内存,优化释放时需要传入空间大小,加入定长内存池,存放映射关系的容器的锁机制,优化性能(基数树,优势,优化前后对比)
  • Composite(组合)
  • 有Bootloader,为什么还要BROM?
  • 【MATLAB代码】CV和CA模型组成的IMM(滤波方式为UKF),可复制粘贴源代码
  • 【网络】传输层协议TCP(下)
  • 服务器数据恢复—EVA存储故障导致上层应用不可用的数据恢复案例
  • 支持向量机相关证明 解的稀疏性
  • 静态ip和动态ip适合什么场景
  • Istio Gateway发布服务
  • 前端vue3若依框架pnpm run dev启动报错
  • python线条爱心
  • GPU的内存是什么?
  • Linux - 弯路系列1:xshell能够连接上linux,但xftp连不上(子账号可以连接,但不能上传数据)
  • 数组逆序重存放
  • 归并排序:高效算法的深度解析
  • 微服务中常用分布式锁原理及执行流程