http://lucasdebelder.be/googledoodle/这是一个实时版本。
所以正如你在门户网站上看到的那样,它周围有一个发光,这是我想让它打开和关闭box-shadow;
,所以感觉更真实,我已经添加了transition: box-shadow ease-in-out;
但它只在开始时这样做,在页面加载之后,然后继续发光。
下面是相关代码。(portaal_links的意思是左门户,rechts的意思是右,是荷兰语(
.HTML:
<div class="portaal portaal_links"></div>
<div class="portaal portaal_rechts"></div>
.CSS:
/*portaal general*/
.portaal {
position: absolute;
width: 100px;
height: 200px;
border-radius: 50px / 100px;
bottom: 315px;
}
/*portaal left*/
.portaal_links {
background: radial-gradient(ellipse at center, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
transition: box-shadow ease-in-out;
transition-delay: 1s;
transition-duration: 1s;
box-shadow: 0 0 55px #57B6FF;
opacity: 0.75;
left: 50px;
}
.portaal_rechts {
background: radial-gradient(ellipse at center, rgba(243,197,189,1) 0%,rgba(232,108,87,1) 50%,rgba(234,40,3,1) 51%,rgba(255,102,0,1) 75%,rgba(199,34,0,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
box-shadow: 0 0 55px #FF6600;
opacity: 0.55;
left: 750px;
}
使用动画而不是过渡。
关键帧:https://www.w3schools.com/cssref/css3_pr_animation-keyframes.asp
动画:https://www.w3schools.com/css/css3_animations.asp
.test {
background: red;
border-radius: 50%;
width: 100px;
height: 200px;
animation: testing 3s linear infinite; }
@keyframes testing {
25% {
box-shadow: 0 0 55px rgba(0,0,0,0.9); }
75% {
box-shadow: 0 0 0 transparent; }
}
<div class="test"></div>
您可以在box-shadow
上创建一个如下所示的animation
,
/*portaal general*/
.portaal {
position: absolute;
width: 100px;
height: 200px;
border-radius: 50px / 100px;
bottom: 60px;
}
/*portaal left*/
.portaal_links {
background: radial-gradient(ellipse at center, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
transition: box-shadow ease-in-out;
transition-delay: 1s;
transition-duration: 1s;
box-shadow: 0 0 55px #57B6FF;
opacity: 0.75;
left: 50px;
animation:mvv 2s infinite;
}
@keyframes mvv{
0%{
box-shadow: 0 0 55px #57B6FF;
}
50%{
box-shadow: 0 0 0px #57B6FF;
}
}
.portaal_rechts {
background: radial-gradient(ellipse at center, rgba(243,197,189,1) 0%,rgba(232,108,87,1) 50%,rgba(234,40,3,1) 51%,rgba(255,102,0,1) 75%,rgba(199,34,0,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
box-shadow: 0 0 55px #FF6600;
opacity: 0.55;
left: 750px;
animation:mv 2s infinite;
}
@keyframes mv{
0%{
box-shadow: 0 0 55px #FF6600;
}
50%{
box-shadow: 0 0 0px #FF6600;
}
}
<div class="portaal portaal_links"></div>
<div class="portaal portaal_rechts"></div>