web特效
折叠隐藏文字

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>被折叠隐藏的字符</title>
<style>
*{
margin: 0px;
padding: 0px;
}
.char1{
background-color: red;
margin: auto;
border-radius: 65px;
padding-left: 50px;
padding-right: 50px;
}
.my-span{
color: white;
font-size: 100px;
display: inline-block;
transition: 1s;
}
.my-hide{
opacity: 0;
width: 0px;
}
.char1:hover>span.my-hide{
opacity: 1;
width:90px;
}
.my-div-top{
width: 100%;
height: 50vh;
background-color: lightblue;
display: flex;
}
.my-div-bottom{
width: 100%;
height: 50vh;
background-color: lightgreen;
display: flex;
}
.my-fix-width{
width: 640px;
text-align: center;
}
</style>
</head>
<body>
<div class="my-div-top">
<div class="char1">
<span class="my-span">碧</span>
<span class="my-span my-hide">蓝</span>
<span class="my-span my-hide">航</span>
<span class="my-span">线</span>
</div>
<div class="char1">
<span class="my-span">高</span>
<span class="my-span my-hide">校</span>
<span class="my-span my-hide">舰</span>
<span class="my-span">队</span>
</div>
</div>
<div class="my-div-bottom">
<div class="char1 my-fix-width">
<span class="my-span">公</span>
<span class="my-span my-hide">主</span>
<span class="my-span my-hide">链</span>
<span class="my-span">接</span>
</div>
</div>
</body>
</html>
炫酷复选框


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>炫酷的复选按钮</title>
<style>
*{
padding: 0px;
margin: 0px;
}
body{
width: 100%;
height: 100vh;
background-color: lightblue;
display: flex;
}
.my-checkbox{
display: block;
width: 200px;
height: 80px;
margin: auto;
-webkit-appearance: none;
-moz-appearance: none;
outline: none;
border: 5px solid #888888;
border-radius: 40px;
background: linear-gradient(to bottom,#5B5B5B,#F0F0F0F0);
box-shadow: 8px 6px 20px #888888,inset 5px -5px 30px #333333;
position: relative;
transition: 0.5s;
}
.my-checkbox::before{
display: block;
content: "";
width: 120px;
height: 60px;
background: linear-gradient(to top,#000,#6b6b6b);
border: 5px solid #555555;
border-radius: 35px;
position: absolute;
left: 0px;
top: 0px;
transition: 0.5s;
}
.my-checkbox::after{
display: block;
content: "";
width: 10px;
height: 10px;
background: darkgray;
border-radius: 50%;
transform: translate(0,-50%);
position: absolute;
left: 90px;
top: 50%;
transition: 0.5s;
box-shadow: 0 0 15px deepskyblue;
}
.my-checkbox:checked::before{
left:60px;
}
.my-checkbox:checked::after{
left:150px;
background-color: deepskyblue;
box-shadow: 0 0 0px deepskyblue;
}
.my-checkbox:checked{
border: 5px solid deepskyblue;
border-radius: 40px;
background: linear-gradient(to bottom,#00aeae,#a6ffff);
box-shadow: 8px 6px 20px #888888,inset 5px -5px 30px #007979;
}
</style>
</head>
<body>
<input type="checkbox" class="my-checkbox"/>
</body>
</html>
波动加载条

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{
padding: 0px;
margin: 0px;
}
.top{
display: flex;
height: 50vh;
background-color: darkgreen;
}
.bottom{
display: flex;
height: 50vh;
background-color: deepskyblue;
}
.loading{
margin: auto;
}
.loading>span{
display: inline-block;
width: 20px;
height: 100px;
background-color: white;
border-radius: 10px;
margin-left: 5px;
margin-right: 5px;
animation: spanHeight 1s infinite ;
position: relative;
}
.loading::after{
content: "";
height: 110px;
width: 0px;
background-color: red;
display: inline-block;
}
@keyframes spanHeight {
0%{
height: 20px;
}
50%{
height: 100px;
}
100%{
height: 20px;
}
}
.loading>span:nth-of-type(2){
animation-delay: 0.1s;
}
.loading>span:nth-of-type(3){
animation-delay: 0.2s;
}
.loading>span:nth-of-type(4){
animation-delay: 0.3s;
}
.loading>span:nth-of-type(5){
animation-delay: 0.4s;
}
.loading>span:nth-of-type(6){
animation-delay: 0.5s;
}
.loading>span:nth-of-type(7){
animation-delay: 0.6s;
}
.loading>span:nth-of-type(8){
animation-delay: 0.7s;
}
.loading>span:nth-of-type(9){
animation-delay: 0.8s;
}
.loading>span:nth-of-type(10){
animation-delay: 0.9s;
}
.load2>span{
vertical-align: middle;
}
.load3>span{
vertical-align: top;
}
.load4>span{
vertical-align: top;
background-color: transparent;
}
.loading>span>div{
text-align: center;
font-size: 20px;
position: absolute;
bottom: 0px;
width: 100%;
}
.load4>span>div{
font-size: 40px;
}
</style>
</head>
<body>
<div class="top">
<div class="loading load1">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="loading load2">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<div class="bottom">
<div class="loading load3">
<span><div>L</div></span>
<span><div>o</div></span>
<span><div>a</div></span>
<span><div>d</div></span>
<span><div>i</div></span>
<span><div>n</div></span>
<span><div>g</div></span>
<span><div>.</div></span>
<span><div>.</div></span>
<span><div>.</div></span>
</div>
<div class="loading load4">
<span><div>L</div></span>
<span><div>o</div></span>
<span><div>a</div></span>
<span><div>d</div></span>
<span><div>i</div></span>
<span><div>n</div></span>
<span><div>g</div></span>
<span><div>.</div></span>
<span><div>.</div></span>
<span><div>.</div></span>
</div>
</div>
</body>
</html>
音乐波动加载条

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{
padding: 0px;
margin: 0px;
}
.top{
display: flex;
height: 50vh;
background-color: darkgreen;
}
.bottom{
display: flex;
height: 50vh;
background-color: deepskyblue;
}
.loading{
margin: auto;
}
.loading>span{
display: inline-block;
width: 20px;
height: 100px;
background-color: white;
border-radius: 10px;
margin-left: 5px;
margin-right: 5px;
animation: spanHeight 1s infinite ;
position: relative;
}
.loading::after{
content: "";
height: 210px;
width: 0px;
background-color: red;
display: inline-block;
}
#btn{
height: 50px;
padding-left: 20px;
padding-right: 20px;
}
</style>
<script src="./js/jquery-3.1.0.min.js"></script>
<script type="text/javascript">
var analyser = null;
var inited = false;
$(function () {
$('#btn').click(function () {
if(!(window.AudioContext || window.webkitAudioContext)){
alert("当前浏览器不支持音频处理");
return;
}
if(inited == false){
inited = true;
var context = new window.AudioContext;
if(context == null){
context = new window.webkitAudioContext;
}
var source = context.createMediaElementSource($('#player')[0]);
analyser = context.createAnalyser();
analyser.fftSize = 32;
source.connect(analyser);
analyser.connect(context.destination);
}
setInterval("draw()",80);
});
});
function draw() {
var arr = new Uint8Array(32);
analyser.getByteTimeDomainData(arr);
for (var i = 0; i < arr.length; i++) {
console.log(i + "=" + arr[i]);
$('.loading>span').eq(i).height(100*(arr[i]/128.0));
}
}
</script>
</head>
<body>
<div class="top">
<audio src="./audio/op.mp3" controls id="player"></audio>
<button id="btn">波形跟踪</button>
</div>
<div class="bottom">
<div class="loading load1">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
</body>
</html>
流彩边框

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>流彩边框</title>
</head>
<style>
*{
padding: 0px;
margin: 0px;
}
body{
height: 100vh;
background-color: black;
display: flex;
}
.my-btn{
font-size: 50px;
padding: 5px 50px;
background: linear-gradient(45deg,lightgreen,lightblue,lightgoldenrodyellow);
margin: auto;
position: relative;
overflow: hidden;
}
.my-top{
width: 100%;
height: 3px;
position: absolute;
top: 0px;
left: -100%;
background: linear-gradient(to right,transparent,lightcoral,deepskyblue,blue,transparent);
animation: animateBorderTop 2s infinite linear;
}
@keyframes animateBorderTop {
from{
left: -100%;
}
to{
left: 300%;
}
}
.my-right{
width: 3px;
height: 100%;
position: absolute;
top: -100%;
right: 0px;
background: linear-gradient(to bottom,transparent,lightcoral,deepskyblue,blue,transparent);
animation: animateBorderRight 2s infinite linear;
animation-delay: 0.5s;
}
@keyframes animateBorderRight {
from{
top: -100%;
}
to{
top: 300%;
}
}
.my-bottom{
width: 100%;
height: 3px;
position: absolute;
bottom: 0px;
left: 100%;
background: linear-gradient(to left,transparent,lightcoral,deepskyblue,blue,transparent);
animation: animateBorderBottom 2s infinite linear;
animation-delay: calc(0.5s * 2 );
}
@keyframes animateBorderBottom {
from{
left: 100%;
}
to{
left: -300%;
}
}
.my-left{
width: 3px;
height: 100%;
position: absolute;
top: 100%;
left: 0px;
background: linear-gradient(to top,transparent,lightcoral,deepskyblue,blue,transparent);
animation: animateBorderLeft 2s infinite linear;
animation-delay: calc(0.5s * 3);
}
@keyframes animateBorderLeft {
from{
top: 100%;
}
to{
top: -300%;
}
}
.my-hover>div{
animation: none;
}
.my-hover:hover>.my-top{
animation: animateBorderTop 0.2s 1 linear;
animation-delay: calc(0.1s * 0);
}
.my-hover:hover>.my-right{
animation: animateBorderRight 0.2s 1 linear;
animation-delay: calc(0.1s * 1);
}
.my-hover:hover>.my-bottom{
animation: animateBorderBottom 0.2s 1 linear;
animation-delay: calc(0.1s * 2);
}
.my-hover:hover>.my-left{
animation: animateBorderLeft 0.2s 1 linear;
animation-delay: calc(0.1s * 3);
}
</style>
<body>
<div class="my-btn">
登录
<div class="my-top"></div>
<div class="my-right"></div>
<div class="my-bottom"></div>
<div class="my-left"></div>
</div>
<div class="my-btn my-hover">
注册
<div class="my-top"></div>
<div class="my-right"></div>
<div class="my-bottom"></div>
<div class="my-left"></div>
</div>
</body>
</html>
环形指示器
基本属性操作

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>环形指示器实例</title>
<style>
body>div{
display: inline-block;
}
</style>
<script src="../js/jquery-3.1.0.min.js"></script>
<script src="../js/radialIndicator.min.js"></script>
<script type="text/javascript">
var app3 = null;
var timer = null;
$(function () {
radialIndicator("#app",{
initValue:50,
radius:100,
barWidth:20,
barColor:"#53ccff",
roundCorner: true,
minValue:0,
maxValue:60,
displayNumber: true,
percentage:true,
});
radialIndicator("#app2",{
initValue:50000,
radius:100,
barWidth:20,
barColor:"#53ccff",
roundCorner: true,
minValue:0,
maxValue:1000000,
displayNumber: true,
percentage:false,
format:"$ ###,###,###元"
});
app3 = radialIndicator("#app3",{
initValue:0,
radius:100,
barWidth:20,
barColor:{
0:"#f00",
50:"#ff0",
100:"#0f0"
},
roundCorner: true,
minValue:0,
maxValue:100,
displayNumber: true,
percentage:false,
});
timer = setInterval("changeApp3()",100);
});
var app3Value = 0;
function changeApp3() {
app3Value+=5;
app3.animate(app3Value);
if(app3Value >= 100){
clearInterval(timer);
}
}
</script>
</head>
<body>
<div id="app"></div>
<div id="app2"></div>
<div id="app3"></div>
<div id="app4"></div>
</body>
</html>
CD时间的环形指示器

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CD冷却时间</title>
<style>
*{
padding: 0px;
margin: 0px;
}
body{
display: flex;
height: 100vh;
}
#app{
margin: auto;
}
</style>
<script src="../js/jquery-3.1.0.min.js"></script>
<script src="../js/radialIndicator.min.js"></script>
<script type="text/javascript">
var app = null;
var timer = null;
$(function () {
app = radialIndicator("#app",{
initValue:50,
radius:0,
barWidth:400,
barColor:{
0:"#ff0000",
100:"#0f0"
},
fontColor:"#000",
fontSize:100,
roundCorner: false,
minValue:0,
maxValue:100,
format:function () {
return 100 - leftTime;
}
});
timer = setInterval("CDTime()",50);
});
var leftTime = 0;
function CDTime() {
leftTime += 1;
app.value(leftTime);
if(leftTime >= 100){
clearInterval(timer);
}
}
</script>
</head>
<body>
<div id="app"></div>
</body>
</html>
时钟环形指示器

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>时钟</title>
<style>
*{
padding: 0px;
margin: 0px;
}
body{
display: flex;
height: 100vh;
}
#app{
margin: auto;
}
</style>
<script src="../js/jquery-3.1.0.min.js"></script>
<script src="../js/radialIndicator.min.js"></script>
<script type="text/javascript">
var app = null;
var timer = null;
$(function () {
app = radialIndicator("#app",{
initValue:50,
radius:150,
barWidth:40,
barColor:{
0:"#ff0000",
100:"#0f0"
},
fontColor:"#000",
fontSize:50,
roundCorner: true,
minValue:0,
maxValue:60,
format:function () {
var now = new Date();
var str = "";
if(now.getHours() >= 10){
str += now.getHours();
}else{
str += ("0"+now.getHours());
}
str += ":";
if(now.getMinutes() >= 10){
str += now.getMinutes();
}else{
str += ("0"+now.getMinutes());
}
str += ":";
if(now.getSeconds() >= 10){
str += now.getSeconds();
}else{
str += ("0"+now.getSeconds());
}
return str;
}
});
timer = setInterval("Time()",1000);
});
function Time() {
var now = new Date();
app.value(now.getSeconds());
}
</script>
</head>
<body>
<div id="app"></div>
</body>
</html>
使用bootstrap和jquery-easing来设计自定义进度条

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>自定义进度条</title>
<link rel="stylesheet" href="../css/bootstrap.css"/>
<style>
.my-progressbar {
width: 100%;
height: 15px;
background: transparent;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border: 1px solid darkgray;
margin: 10px 0 15px;
padding: 3px;
position: relative;
}
.my-progressbar .progress-value {
height: 100%;
width: 0%;
background: url("../img/progress-bar.jpg") repeat-x;
background-position: 0% 0%;
animation: backgroundRolling 6s linear infinite;
-webkit-animation: backgroundRolling 6s linear infinite;
-moz-animation: backgroundRolling 6s linear infinite;
}
.my-progressbar .progress-percent {
background: url("../img/progressbar-percent.png") 0 0 no-repeat;
width: 34px;
height: 35px;
display: none;
color: white;
font-size: 10px;
position: absolute;
top: -34px;
left: 0%;
margin-left: -17px;
text-align: center;
padding-top: 2px;
padding-right:4px ;
}
@keyframes backgroundRolling {
from {
background-position: 0% 0%;
}
to {
background-position: 100% 0%;
}
}
@-webkit-keyframes backgroundRolling {
from {
background-position: 0% 0%;
}
to {
background-position: 100% 0%;
}
}
@-moz-keyframes backgroundRolling {
from {
background-position: 0% 0%;
}
to {
background-position: 100% 0%;
}
}
</style>
</head>
<body>
<div class="container">
<h1>项目进度</h1>
<div>
<p>UI设计</p>
<div class="my-progressbar" data-percent="65">
<div class="progress-value"></div>
<span class="progress-percent"></span>
</div>
</div>
</div>
<script src="../js/jquery-3.4.1.min.js"></script>
<script src="../js/bootstrap.js"></script>
<script src="../js/jquery-easing.js"></script>
<script type="text/javascript">
$(function () {
$(window).bind("scroll load resize",function () {
animateProgressBars();
})
});
function animateProgressBars() {
var window_h = $(window).height();
var scrollingTop = $(window).scrollTop();
$('.my-progressbar').each(function () {
var one = $(this);
var bar_y = one.offset().top;
if(!one.hasClass("animating") && bar_y <(window_h + scrollingTop)){
barStartAnimateReal(one);
}
})
}
function barStartAnimateReal(bar) {
var bar_progress = bar.find(".progress-value");
var bar_percent = bar.find(".progress-percent");
bar.addClass("animating");
bar_percent.fadeIn(200);
var percent = parseInt(bar.data("percent"));
bar_progress.animate({
width:percent + "%",
},{
duration:1000,
easing:'easeOutElastic',
step:function (now,fx) {
bar_percent.text(now + "%").css("left", parseInt(now) + "%");
}
})
}
</script>
</body>
</html>