[英]Image (SandTimer) Animation - HTML, CSS, Javascript
I created a Loading screen using HTML and CSS .我使用 HTML 和 CSS 创建了一个加载屏幕。 But i need to make the sandtimer image animated (Sandtimer rotating and sand pouring down from top).
但我需要让沙盘图像动画化(沙盘旋转,沙子从顶部倾泻而下)。 Any help would be much appreciated in animation.
任何帮助将不胜感激动画。 My code is given below.
我的代码如下。
<style type="text/css">
.load-modal-box{
border-radius: 8px;
-webkit-box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.2);
box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.2);
width: 710px;
height: 530px;
background: -webkit-linear-gradient(top, #f1f1f1 65%, #f1f1f1 65%);
z-index: 3;
position: fixed;
top: 76px;
left: 46px;
overflow: hidden;
}
.load{
height: 500%;
width: 500%;
position: absolute;
z-index: 11;
top: -40px;
}
</style>
<div class = "load" id="loadmodalbox">
<div class="load-modal-box">
<img src="./images/sandtimerpngg.png" style="position: absolute;
left: 300px;
width: 80px;
height: 100px;
top: 170px">
<h2 style="text-align: center;color: #6f7475;padding-top: 270px;">Loading.. Please wait..</h2>
</div>
</div>
As a developer, I am lazy!作为开发者,我很懒惰! I quickly found an example by Travis Bernard of what you are trying to achieve on CodePen that uses only HTML and CSS.
我很快就找到了Travis Bernard的一个示例,说明您在仅使用 HTML 和 CSS 的 CodePen 上尝试实现的目标。
Reference for more examples: https://codepen.io/tag/hourglass/
更多示例参考: https : //codepen.io/tag/hourglass/
*, *:before, *:after { box-sizing: border-box; } .hourglass { font-size: 2em; } div { width: 3.5em; height: 5em; border-style: solid; border-width: 2.5em 1.2em; border-color: blue transparent; border-radius: 10%; position: relative; animation: spin 5s linear infinite; } div:before { content: ""; width: 2.5em; height: 4.5em; border-style: solid; border-width: 2.25em 1.1em; border-color: white transparent transparent; border-radius: 10%; position: absolute; top: -2.25em; left: -.7em; animation: slideOut 5s linear infinite; } div:after { content: ""; width: 2.5em; height: 4.5em; border-style: solid; border-width: 0em 1.1em; border-color: transparent transparent white; border-radius: 10%; position: absolute; top: -2.25em; left: -.7em; animation: slideIn 5s linear infinite; } @keyframes spin { 0% { transform: rotation(0deg); } 90% { transform: rotate(0deg); } 100% { transform: rotate(180deg); } } @keyframes slideOut { 0% { top: -2.25em; width: 2.5; border-width: 2.25em 1.1em; } 90% { top: 0em; width: 0; border-width: 0em 0em; left: .55em; } 100% { top: 0em; width: 0; border-width: 0em 0em; left: .55em; } } @keyframes slideIn { 0% { border-width: 0em 1.1em; } 90% { border-width: 2.25em 1.1em; } 100% { border-width: 2.25em 1.1em; } }
<div class="hourglass"></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.