html设计(两种常见的充电效果)
    		       		warning:
    		            这篇文章距离上次修改已过441天,其中的内容可能已经有所变动。
    		        
        		                
                以下是两种不同的充电效果的HTML设计实例:
- 简单的圆形充电效果:
HTML:
<div class="loading">
    <div class="loading-circle"></div>
</div>CSS:
.loading {
    width: 100px;
    height: 100px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 5px solid #4285F4;
    border-radius: 50%;
    border-top-color: #64B5F6;
    animation: spin 2s linear infinite;
}
 
.loading-circle {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    position: absolute;
    animation: pulse 2s ease-in-out infinite;
}
 
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
 
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}- 带文字的充电效果:
HTML:
<div class="loading">
    <div class="loading-circle"></div>
    <div class="loading-text">充电中...</div>
</div>CSS:
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
 
.loading-circle {
    width: 50px;
    height: 50px;
    border: 5px solid #4285F4;
    border-radius: 50%;
    border-top-color: #64B5F6;
    animation: spin 2s linear infinite;
}
 
.loading-text {
    margin-top: 10px;
    color: #333;
    font-size: 14px;
}
 
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}这两个实例展示了如何使用HTML、CSS和动画(@keyframes)来创建简单的充电效果。第一个实例是一个简单的圆形充电动画,第二个实例在充电动画上增加了文字信息。这些都是充电效果的常见设计,可以根据具体需求进行样式调整和动画定制。
评论已关闭