css实现墙上挂画打开聚光灯效果代码

代码语言:html

所属分类:其他

代码描述:css实现墙上挂画打开聚光灯效果代码

代码标签: css 墙上 挂画 打开 聚光灯

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

  
  
  
  
<style>
body {
  background: #ce8f3e;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}
section {
  position: relative;
  width: 450px;
  height: 345px;
  flex: 0 0 450px;
}
section .switch {
  display: none;
}
section .lamp {
  position: absolute;
  width: 100%;
  height: 100%;
  --line-d: path('M40,105V240');
  --pommel-cy: 240px;
  --bulb-fill: #ccc;
  --glow-fill: none;
}
section .lamp use {
  cursor: pointer;
}
.switch:checked + .lamp {
  --line-d: path('M40,105V280');
  --pommel-cy: 280px;
  --bulb-fill: #ff0;
  --glow-fill: url(#light);
}
section img {
  position: absolute;
  top: 115px;
  left: 130px;
  width: 225px;
  filter: brightness(30%);
}
section:has(:checked) img {
  filter: drop-shadow(5px 5px 3px black);
}
</style>


</head>

<body>
  <svg width="0" height="0">
  <symbol id="lamp" viewBox="0 0 600 500">
    <radialGradient id="light" cx="100" cy="10" fx="112" fy="75" r="470" gradientUnits="userSpaceOnUse">
      <stop style="stop-color:#ffd;stop-opacity:0.6" offset="0" />
      <stop style="stop-color:#ff8;stop-opacity:0" offset="1" />
    </radialGradient>
    <path style="fill:none;stroke:#784421;stroke-width:2;d:var(--line-d)" />
    <circle style="fill:#f00;cy:var(--pommel-cy)" cx="40" r="5" />
    &.........完整代码请登录后点击上方下载按钮下载查看

网友评论0