HTML5 SVG带圆形进度条动画的提交按钮特效
简要教程
这是一款非常实用的HTML5 SVG带圆形进度条动画的提交按钮特效。该提交按钮在被点击之后,按钮变形为一个圆形的进度条,当进度条运行一周之后,可以设置提交成功和提交失败的两种按钮状态。
制作方法
HTML结构
制作这个提交按钮特效的HTML结构需要一个包裹容器,里面有一个提交按钮和三个
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
CSS样式
首先提交按钮容器需要设置为inline-block样式。
1 2 3 4 5 |
|
然后在为提交按钮提供一些基本样式,并设置过渡动画效果。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
在鼠标滑过提交按钮的时候,修改按钮的背景颜色和文字颜色。
1 2 3 4 |
|
所有的SVG元素都采用绝对定位方式来居中对齐,并且不允许有任何的pointer-events。
1 2 3 4 5 6 7 8 |
|
SVG的路径没有任何的填充色,只有描边。开始的时候它们是被隐藏起来的,透明度被设置为0。
1 2 3 4 |
|
圆形进度条通过设置描边为5个单位来创建。
1 2 3 4 |
|
当开始loading线程的时候,按钮会变形为圆形,和圆形进度条相同的大小。
1 2 3 4 5 6 7 |
|
变为圆形后,调教按钮上的文字要快速隐藏起来。
1 2 3 4 5 6 7 8 9 |
|
JAVASCRIPT
在javascript代码中,button是HTML元素,progressEl是SVG元素,它是代表圆形的进度条。successEl和errorEl分别代表提交成功和失败的标记,也是SVG元素。js代码中通过UIProgressButton()方法来初始化这个提交按钮特效。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
其它js代码请参考下载文件。
以上就是HTML5 SVG带圆形进度条动画的提交按钮特效的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.
