Nag*_*nke 6 css jquery animation jquery-effects jquery-animate
我一直在谷歌搜索像这里的div的效果.
这里使用< canvas >
" radialwipe clock effect " 绘制图像
如何实现这一点.
我找到了这个 javascript库.但它仅为图像提供此效果.
我对div需要同样的效果.
有什么方法可以做到这一点.
提前致谢.
我创建了一个 1/2 时钟动画效果,与您想要的类似。我希望找到提供精确动画的解决方案。
您需要一些动画标记:
<div class="wrapper">
<div class="content">
This is a good day. Maybe.
</div>
<div class="rotate"></div>
<div class="mask"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
content
这是 CSS(用SCSS编写):
$width: 200px;
$height: 200px;
$duration: 2s;
$delay: 1s;
$color-alpha: #308991;
$color-beta: #80c144;
$color-gamma: #b83d54;
.wrapper {
position:relative;
width: $width;
height: $height;
margin:0 auto;
}
.content {
width: $width;
height: $height;
background: $color-beta;
border-radius: 50%;
padding: 2em;
overflow: hidden;
text-align:center;
}
/* Rotates 360 deg */
.rotate {
position: absolute;
z-index: 2;
top: 0;
right: 0;
width: $width / 2;
height: $height;
box-shadow:0 0 0 .15em $color-alpha;
background: $color-alpha;
transform-origin: 0 50%;
animation: rotate $duration linear 1 forwards;
animation-delay: 1s;
}
@keyframes rotate {
0% {
transform: rotate(0deg);
}
62% {
opacity:1;
}
99.99% {
z-index: 2;
}
100% {
transform: rotate(360deg);
opacity: 0;
z-index: -1;
}
}
/* The .content is hidden by .mask until the .rotate reveals it */
.mask {
position:absolute;
z-index:1;
top: -1px;
left: -1px;
width: $width + 2px;
height: $height + 2px;
background:
linear-gradient(top, transparent 50%, $color-alpha 50%),
linear-gradient(top, $color-alpha 50%, transparent 50%);
background:
linear-gradient(to top, transparent 50%, $color-alpha 50%),
linear-gradient(to top, $color-alpha 50%, transparent 50%);
background-position:100% 100%, 0 0;
background-size: 50% 200%;
background-repeat: no-repeat;
border-radius: 50%;
box-shadow:0 0 0 .65em $color-alpha;
animation: mask $duration / 1.25 linear 1 forwards;
animation-delay: (-$duration / 7.5) + $delay;
}
@keyframes mask {
50% {
background-position: 100% 0, 0 0;
}
99.99% {
z-index: 1;
}
100% {
background-position: 100% 0, 0 100%;
z-index: -1;
}
}
Run Code Online (Sandbox Code Playgroud)
您可以在 CodePen 上看到现场演示:1/2 时钟动画
归档时间: |
|
查看次数: |
2708 次 |
最近记录: |