美文网首页uni-app相关
CSS 实现 光圈效果

CSS 实现 光圈效果

作者: evelynlab | 来源:发表于2018-03-12 16:34 被阅读189次

主要利用css3 animation, 在0 ~ 100% 过渡中让box-shadow渐变(box-shadow只需要设置blur 和spread)
HTML:

<div class="wrapper">
        <div class="bg"></div>
        <div class="circle"></div>
    </div>

CSS:

.wrapper {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background-color: #ff6633;
    position: relative;
}
.bg {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: absolute; 
    top: 0;
    left: 0;
    animation: pulse 5s infinite;
}
@keyframes pulse {
    0% {
        box-shadow: 0 0 8px 6px #fff;
    }
    50% {
        box-shadow: 0 0 8px 6px #ff6633;
    }
    100% {
        box-shadow: 0 0 8px 6px #fff;
    }
}
.circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #efefef;
}

预览效果入如下:


test1.gif

相关文章

网友评论

    本文标题:CSS 实现 光圈效果

    本文链接:https://www.haomeiwen.com/subject/sjonfftx.html