纯CSS+SVG电路开关电流流动动画效果源码下载,模拟电路连接与断开的状态变化。

    这是一款物理电路开关示意图动画效果,基于纯CSS+SVG技术实现,通过点击开关触发电流流动动画,模拟电路连接与断开的状态变化。部分代码如下:

<svg width="400" height="300" viewBox="0 0 300 150" xmlns="http://www.w3.org/2000/svg">
    <!-- Main solid wire (background) -->
    <path class="wire-path" d="M 170 30 H 260 V 120 
                              M 30 30 V 60 M 30 90 V 120 
                              M 30 120 H 135 M 155 120 H 260
                              M 30 30 H 120" stroke="currentColor" stroke-width="2" stroke-cap="rounded" fill="none" />

    <!-- Animated overlay wire (will "fill" when checked) -->

    <path class="animated-wire" d="M 170 30 H 260 V 120 
                              M 30 30 V 60 M 30 90 V 120 
                              M 30 120 H 135 M 155 120 H 260
                              M 30 30 H 120" stroke="currentColor" stroke-width="2" fill="none" stroke-dasharray="0 400" stroke-dashoffset="400" />

    <!-- Switch (open by default) -->
    <g class="switch">
       <line x1="120" y1="30" x2="165" y2="10" stroke="currentColor" stroke-width="2.5" />
       <circle cx="120" cy="30" r="4" fill="currentColor" />
       <circle cx="170" cy="30" r="4" fill="currentColor" />
    </g>

    <!-- Lightbulb (initially transparent fill) -->
    <g class="lightbulb" transform="translate(30,75)">
       <circle cx="0" cy="0" r="15" stroke="currentColor" stroke-width="2.5" fill="transparent" />
       <line x1="-8" y1="8" x2="8" y2="-8" stroke="currentColor" stroke-width="2" />
       <line x1="-8" y1="-8" x2="8" y2="8" stroke="currentColor" stroke-width="2" />
    </g>

    <!-- Battery -->
    <g class="battery" transform="translate(145, 120)">
       <rect x="-10" y="-10" width="2.5" height="20" fill="currentColor" />
       <rect x="10" y="-15" width="2.5" height="30" fill="currentColor" />
    </g>
</svg>


模板目录结构如下:
  • 如非特殊说明,本站对本文提供的代码或者素材不拥有任何权利,其版权归原著者拥有。
  • 以上提供的代码或者素材均为作者提供和网友推荐收集整理而来,仅供学习和研究使用。
  • 如有侵犯你版权的,请来信(邮箱:tongzhewangluo@163.com)指出,核实后,本站将立即改正。
  • 如有链接无法下载、失效或广告,请通过网站提供的微信联系作者!
  • 以上资源售价只是赞助,不代表代码或者素材本身价格。收取费用仅维持本站的服务器开销!
  • 所有代码素材效果均为演示打包,最终效果请参考演示效果,本站不提供任何技术支持和服务。
  • 代码素材均为虚拟物品,演示和描述无错的情况下,无法进行退换服务。