首页 建站教程 WEB前端 正文

用SVG给页面按钮添加个性点击效果

首先,GitHub的右上方的“Download Zip”zip文件下载。然后将zip文件解压,将解压后js文件夹中的「TweenMax.min.js」和「main.js」加在网页的</body>前面并加载按钮样式表main.css; <script src="js/TweenMax.min....

用SVG给页面按钮添加个性点击效果 前端 按钮特效 GitHub 图1

首先,GitHub的右上方的“Download Zip”zip文件下载。然后将zip文件解压,将解压后js文件夹中的「TweenMax.min.js」和「main.js」加在网页的</body>前面并加载按钮样式表main.css

<script src="js/TweenMax.min.js"></script>
<script src="js/main.js"></script>
<link href="CSS/main.css"/ rel="stylesheet">

html代码示例:

<button id="component-1" class="button button--1">
    点击按钮
    <span class="button__container">
        <span class="circle top-left"></span>
        <span class="circle top-left"></span>
        <span class="circle top-left"></span>
        <span class="button__bg"></span>
        <span class="circle bottom-right"></span>
        <span class="circle bottom-right"></span>
        <span class="circle bottom-right"></span>
    </span>
</button>

将SVG代码添加在页面的body标签中,位置没有限制:

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="svg-filters">
   <defs>
     <filter id="filter-goo-1">
       <feGaussianBlur in="SourceGraphic" stdDeviation="7" result="blur" />
        <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19 -9"
         result="goo" />
        <feComposite in="SourceGraphic" in2="goo" />
     </filter>
   </defs>
</svg>

从GitHub中下载的代码中还有更多的按钮点击效果,具体的使用方法可以参考文件中的demo。

官方演示:Distorted Button Effects - Codrops

GitHub:GitHub – codrops/DistortedButtonEffects

打赏
海报

本文由优美主题原创或收集发布

转载请注明本文地址:https://www.umtheme.com/web/17.html

相关推荐

CSS心形缠绕转动效果

CSS心形缠绕转动效果

CSS心形缠绕转动效果是一种有趣的动画效果,能够给网页带来浪漫而动感的氛围。这个效果将一个心形图案无限旋转,并且同时绕着一个中心点缠绕旋...
WEB前端 2023.09.13 0 2120
制作h5常用的css3动画效果

制作h5常用的css3动画效果

css3提供了许多强大的特效,可以用来实现各种各样的效果,下面是我总结的一些常用的css3效果,有需要的可以直接引用:1.悬浮时放大:.one{transition:All 0.4s&nb...
WEB前端 2023.09.13 0 1899
发布评论

ainiaobaibaibaibaobaobeishangbishibizuichiguachijingchongjingdahaqiandaliandangaodw_dogedw_erhadw_miaodw_tuzidw_xiongmaodw_zhutouganbeigeiliguiguolaiguzhanghahahahashoushihaixiuhanheixianhenghorse2huaixiaohuatonghuaxinhufenjiayoujiyankeaikeliankouzhaokukuloukunkuxiaolandelinileimuliwulxhainiolxhlikelxhqiuguanzhulxhtouxiaolxhwahahalxhzanningwennonuokpinganqianqiaoqinqinquantouruoshayanshengbingshiwangshuaishuijiaosikaostar0star2star3taikaixintanshoutianpingtouxiaotuwabiweifengweiquweiwuweixiaowenhaowoshouwuxiangjixianhuaxiaoerbuyuxiaokuxiaoxinxinxinxinsuixixixuyeyinxianyinyueyouhenghengyuebingyueliangyunzanzhajizhongguozanzhoumazhuakuangzuohenghengzuoyi
感谢您的支持