css动画:按钮涟漪效果
<template> <div id="app"> <button class="btn btn-primary">按钮1 <span class="mask mask-1"></span></button> <button class="btn btn-secondary">按钮2 <span class="mask mask-2"></span></button> <button class="btn btn-warning">按钮3 <span class="mask mask-3"></span></button> <button class="btn btn-success">按钮4 <span class="mask mask-4"></span></button> </div> </template> <style lang="less" scoped> #app { button { outline: none; border: none; cursor: pointer; } .btn { position: relative; height: 40px; padding: 0 15px; color: #fff; font-size: 16px; border: 1px solid; border-radius: 3px; margin: 0 10px; } .btn-primary { background-color: #337ab7; border-color: #2e6da4; } .btn-secondary { background-color: #5bc0de; border-color: #46b8da; } .btn-warning { background-color: #f0ad4e; border-color: #eea236; } .btn-success { background-color: #5cb85c; border-color: #4cae4c; } .mask { position: absolute; height: 100%; background-color: #fff; opacity: 1; } .mask-1 { top: 0; right: 0; } .mask-2 { top: 0; left: 0; border-top-right-radius: 40px; } .mask-3 { left: 50%; top: 50%; width: 0; height: 0; border-radius: 50%; } .mask-4 { width: 100%; height: 0; left: 0; bottom: 0; } .btn-primary:hover .mask-1 { animation-name: btn-animation-one; animation-duration: 1s; } .btn-secondary:hover .mask-2 { animation-name: btn-animation-one; animation-duration: 1s; } .btn-warning:hover .mask-3 { animation-name: btn-animation-three; animation-duration: 1s; } .btn-success:hover .mask-4 { animation-name: btn-animation-four; animation-duration: 1s; } @keyframes btn-animation-one { from { width: 0; opacity: 1; } to { width: 100%; opacity: 0; } } @keyframes btn-animation-three { from { width: 1px; height: 1px; transform: scale(0); opacity: 1; } to { width: 1px; height: 1px; transform: scale(100); opacity: 0; } } @keyframes btn-animation-four { from { height: 0; opacity: 1; } to { height: 100%; opacity: 0; } } } </style>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 提示词工程——AI应用必不可少的技术
· 字符编码:从基础到乱码解决
· 地球OL攻略 —— 某应届生求职总结
2020-10-09 vue登录时人机验证-滑块验证