CSS3灯塔3d灯光特效
灯塔象征守护神和阳光,寓意希望,坚定而执着,始终如一不离不弃。灯塔,为一切夜里航行的人,用火光把道路照明,无私奉献。灯塔为迷茫的船只指引航行的方向,勇于承担,责任重大。
1.设计思路
- 利用CSS3画出灯塔的外观
- 画出灯塔射出的灯光并完成动画
- 将灯塔封装为标签
2.编码
1)html灯塔布局
html:
<div id="lighthouse">
<div id="top"></div>
<div id="lighttop"></div>
<div id="lightcontent"></div>
<div id="lightbottom"></div>
<div id="towerbody"></div>
<div id="towerlight"></div>
</div>
css:
:root{
--width:150px;
--height:250px;
}
#lighthouse{
width: var(--width);
height: var(--height);
position: absolute;
right: 0;
bottom: 0;
}
#lighthouse #top{
width: 0px;
height: 0px;
border-bottom: calc(var(--width)*0.2) solid #c0c0c0;
border-left: calc(var(--width)*0.2) solid transparent;
border-right: calc(var(--width)*0.2) solid transparent;
margin: 0 auto;
}
#lighthouse #lighttop,#lightbottom{
width: calc(var(--width)*0.5);
height: calc(var(--height)*0.05);
background-color: palegoldenrod;
margin: 0 auto;
border-radius: 8%;
}
#lighthouse #lightcontent{
width: