CSS 实现 光圈效果

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

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;
}

预览效果入如下:


CSS 实现 光圈效果_第1张图片
test1.gif

你可能感兴趣的:(CSS 实现 光圈效果)