找回密码
 立即注册
搜索

能量启动装饰代码

[复制链接]
发表于 2025-2-8 20:34:50 | 显示全部楼层 |阅读模式


  1. <!DOCTYPE html>
  2. <html lang="en">
  3.   <head>
  4.     <meta charset="UTF-8" />
  5.     <title>能量启动</title>
  6.     <link
  7.       rel="stylesheet"
  8.       href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css"
  9.     />
  10.     <style>
  11.       /* General Styles */
  12.       body {
  13.         display: flex;
  14.         justify-content: center;
  15.         align-items: center;
  16.         height: 100vh;
  17.         background-color: #1a1a1a;
  18.         margin: 0;
  19.         flex-direction: column;
  20.       }

  21.       /* Power Button */
  22.       .power-btn {
  23.         width: 80px;
  24.         height: 80px;
  25.         border: none;
  26.         border-radius: 50%;
  27.         background: radial-gradient(circle, #ff6600 30%, #cc5500 60%);
  28.         box-shadow: 0 4px 8px rgba(255, 102, 0, 0.5),
  29.           inset 0 2px 6px rgba(0, 0, 0, 0.4);
  30.         display: flex;
  31.         justify-content: center;
  32.         align-items: center;
  33.         cursor: pointer;
  34.         transition: all 0.3s ease-in-out;
  35.         position: relative;
  36.       }

  37.       .power-btn:hover {
  38.         box-shadow: 0 0 10px rgba(255, 102, 0, 0.8);
  39.         transform: scale(1.05);
  40.       }

  41.       .power-btn.on {
  42.         background: radial-gradient(circle, #ff3300 30%, #cc2200 60%);
  43.         box-shadow: 0 0 20px rgba(255, 102, 0, 0.8);
  44.       }

  45.       /* Status Text */
  46.       .status {
  47.         margin-top: 10px;
  48.         font-size: 18px;
  49.         color: white;
  50.         font-family: Arial, sans-serif;
  51.         opacity: 0;
  52.         transition: opacity 0.5s ease-in-out;
  53.       }

  54.       /* Lightbulbs */
  55.       .lightbulbs {
  56.         display: flex;
  57.         gap: 15px;
  58.         margin-top: 20px;
  59.       }

  60.       .lightbulb {
  61.         font-size: 40px;
  62.         color: gray;
  63.         opacity: 0.2;
  64.         transition: opacity 0.5s ease-in-out, transform 0.3s;
  65.       }

  66.       .lightbulb.on {
  67.         color: yellow;
  68.         opacity: 1;
  69.         text-shadow: 0 0 15px rgba(255, 255, 0, 0.7);
  70.         transform: scale(1.1);
  71.       }

  72.       /* Gear */
  73.       .gear-container {
  74.         margin-top: 20px;
  75.       }

  76.       .gear {
  77.         font-size: 50px;
  78.         color: silver;
  79.         opacity: 0.5;
  80.         transition: opacity 0.5s ease-in-out;
  81.       }

  82.       /* Battery */
  83.       .battery-container {
  84.         margin-top: 20px;
  85.         font-size: 35px;
  86.       }

  87.       .battery {
  88.         color: gray;
  89.         opacity: 0.5;
  90.         transition: opacity 0.5s ease-in-out, color 0.5s;
  91.       }

  92.       .battery.on {
  93.         color: green;
  94.         opacity: 1;
  95.       }

  96.       /* WiFi */
  97.       .wifi-container {
  98.         margin-top: 20px;
  99.         font-size: 35px;
  100.       }

  101.       .wifi {
  102.         color: black;
  103.         opacity: 0.5;
  104.         transition: opacity 0.5s ease-in-out, color 0.5s;
  105.       }

  106.       .wifi.connected {
  107.         color: lightblue;
  108.         opacity: 1;
  109.         animation: pulse 1s infinite alternate;
  110.       }

  111.       @keyframes pulse {
  112.         0% {
  113.           transform: scale(1);
  114.         }
  115.         100% {
  116.           transform: scale(1.1);
  117.         }
  118.       }

  119.       .atom-icon {
  120.         padding: 10px;
  121.         font-size: 50px;
  122.         color: gray;
  123.         opacity: 0.3;
  124.         transition: opacity 0.5s ease-in-out, text-shadow 0.5s ease-in-out;
  125.       }

  126.       .atom-icon.active {
  127.         color: cyan;
  128.         opacity: 1;
  129.         text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
  130.         animation: spinAtom 3s linear infinite, glow 1.5s alternate infinite;
  131.       }

  132.       #screen-flicker {
  133.         position: fixed;
  134.         top: 0;
  135.         left: 0;
  136.         width: 100%;
  137.         height: 100%;
  138.         background: black;
  139.         opacity: 0;
  140.         visibility: hidden;
  141.         z-index: 100;
  142.         transition: opacity 0.2s ease-in-out;
  143.       }

  144.       #screen-flicker.active {
  145.         visibility: visible;
  146.         animation: flicker 1s ease-in-out;
  147.       }

  148.       @keyframes flicker {
  149.         0% {
  150.           opacity: 1;
  151.         }
  152.         25% {
  153.           opacity: 0.7;
  154.         }
  155.         50% {
  156.           opacity: 1;
  157.         }
  158.         75% {
  159.           opacity: 0.5;
  160.         }
  161.         100% {
  162.           opacity: 0;
  163.         }
  164.       }

  165.       body.power-on {
  166.         animation: pulseGlow 3s infinite alternate;
  167.       }

  168.       @keyframes pulseGlow {
  169.         0% {
  170.           background-color: #1a1a1a;
  171.         }
  172.         100% {
  173.           background-color: #242424;
  174.         }
  175.       }

  176.       /* Fan Container */
  177.       .fan-container {
  178.         display: flex;
  179.         justify-content: center;
  180.         gap: 20px;
  181.         margin-bottom: 15px; /* Spacing above the atom */
  182.       }

  183.       /* Fans (default state) */
  184.       .fan-icon {
  185.         font-size: 50px;
  186.         color: gray;
  187.         opacity: 0.3;
  188.         transition: opacity 0.5s ease-in-out;
  189.       }

  190.       /* Fans Spin Animation */
  191.       .fan-icon.spinning {
  192.         opacity: 1;
  193.         color: silver;
  194.         animation: spinFan 2s linear infinite;
  195.       }

  196.       @keyframes spinFan {
  197.         0% {
  198.           transform: rotate(0deg);
  199.         }
  200.         100% {
  201.           transform: rotate(360deg);
  202.         }
  203.       }
  204.     </style>
  205.   </head>
  206.   <body>
  207.     <!-- partial:index.partial.html -->
  208.     <button id="powerButton" class="power-btn">
  209.       <i class="fa-solid fa-power-off"></i>
  210.     </button>

  211.     <div class="status" id="statusText">System On</div>

  212.     <div class="lightbulbs">
  213.       <i class="fa-regular fa-lightbulb lightbulb" id="lightbulb1"></i>
  214.       <i class="fa-regular fa-lightbulb lightbulb" id="lightbulb2"></i>
  215.       <i class="fa-regular fa-lightbulb lightbulb" id="lightbulb3"></i>
  216.     </div>

  217.     <div class="gear-container">
  218.       <i class="fa-solid fa-gear gear" id="gear"></i>
  219.     </div>

  220.     <div class="battery-container">
  221.       <i class="fa-solid fa-battery-empty battery" id="battery"></i>
  222.     </div>
  223.     <div class="fan-container">
  224.       <i class="fa-solid fa-fan fan-icon" id="fan1"></i>
  225.       <i class="fa-solid fa-fan fan-icon" id="fan2"></i>
  226.     </div>
  227.     <div class="atom-container">
  228.       <i class="fa-solid fa-atom atom-icon"></i>
  229.     </div>
  230.     <!-- partial -->
  231.     <script src="https://unpkg.com/gsap@3/dist/gsap.min.js"></script>
  232.     <script>
  233.       const powerButton = document.getElementById('powerButton');
  234.       const statusText = document.getElementById('statusText');
  235.       const lightbulbs = document.querySelectorAll('.lightbulb');
  236.       const gear = document.getElementById('gear');
  237.       const battery = document.getElementById('battery');
  238.       const wifi = document.getElementById('wifi');
  239.       const atomIcon = document.querySelector('.atom-icon');
  240.       const fans = document.querySelectorAll('.fan-icon');

  241.       const batteryLevels = [
  242.         'fa-battery-empty',
  243.         'fa-battery-quarter',
  244.         'fa-battery-half',
  245.         'fa-battery-three-quarters',
  246.         'fa-battery-full',
  247.       ];

  248.       // Atom activation
  249.       function activateAtom() {
  250.         atomIcon.classList.add('active');
  251.         gsap.to(atomIcon, { opacity: 1, duration: 0.5 });
  252.       }

  253.       function deactivateAtom() {
  254.         gsap.to(atomIcon, { opacity: 0.3, duration: 0.5 }); // Fade out smoothly
  255.         setTimeout(() => {
  256.           atomIcon.classList.remove('active');
  257.           gsap.killTweensOf(atomIcon); // Stop animation
  258.         }, 500); // Delay before fully stopping the atom
  259.       }

  260.       // Lightbulbs
  261.       function turnOnLightbulbs() {
  262.         lightbulbs.forEach((bulb, index) => {
  263.           setTimeout(() => {
  264.             bulb.classList.add('on');
  265.           }, index * 250);
  266.         });
  267.       }

  268.       function turnOffLightbulbs() {
  269.         lightbulbs.forEach((bulb, index) => {
  270.           setTimeout(() => {
  271.             bulb.classList.remove('on');
  272.           }, index * 250);
  273.         });
  274.       }

  275.       // Gear
  276.       function startGear() {
  277.         gsap.to(gear, {
  278.           opacity: 1,
  279.           rotation: 360,
  280.           duration: 2,
  281.           repeat: -1,
  282.           ease: 'linear',
  283.         });
  284.       }

  285.       function stopGear() {
  286.         gsap.to(gear, { opacity: 0.5, duration: 0.5 }); // Fade out first
  287.         setTimeout(() => {
  288.           gsap.killTweensOf(gear); // Stop animation
  289.           gsap.set(gear, { rotation: 0 }); // Reset rotation
  290.         }, 500);
  291.       }

  292.       // Battery
  293.       function chargeBattery() {
  294.         battery.classList.add('on');
  295.         let level = 0;
  296.         function nextChargeStep() {
  297.           if (level < batteryLevels.length) {
  298.             battery.classList.remove(...batteryLevels);
  299.             battery.classList.add(batteryLevels[level]);
  300.             level++;
  301.             setTimeout(nextChargeStep, 600);
  302.           }
  303.         }
  304.         nextChargeStep();
  305.       }

  306.       function drainBattery() {
  307.         setTimeout(() => {
  308.           battery.classList.remove('on', ...batteryLevels);
  309.           battery.classList.add('fa-battery-empty');
  310.         }, 800); // Battery drains after 0.8s
  311.       }

  312.       // Fans
  313.       function startFans() {
  314.         fans.forEach((fan) => fan.classList.add('spinning'));
  315.       }

  316.       function stopFans() {
  317.         setTimeout(() => {
  318.           fans.forEach((fan) => fan.classList.remove('spinning'));
  319.         }, 1000); // Fans stop after 1s for a gradual effect
  320.       }

  321.       // Background Pulse
  322.       function enableBackgroundPulse() {
  323.         document.body.classList.add('power-on');
  324.       }

  325.       function disableBackgroundPulse() {
  326.         setTimeout(() => {
  327.           document.body.classList.remove('power-on');
  328.         }, 1200); // Background pulse stops last
  329.       }

  330.       // Unified Power Button Event Listener
  331.       powerButton.addEventListener('click', function () {
  332.         if (this.classList.contains('on')) {
  333.           // Powering OFF
  334.           this.classList.remove('on');
  335.           gsap.to(this, { scale: 1, duration: 0.2 });
  336.           gsap.to(this, {
  337.             boxShadow: '0 0 10px rgba(255, 102, 0, 0.5)',
  338.             duration: 0.5,
  339.           });
  340.           gsap.to(statusText, { opacity: 0, duration: 0.5 });

  341.           // Delayed Shutdown Sequence
  342.           setTimeout(turnOffLightbulbs, 500);
  343.           setTimeout(drainBattery, 1000);
  344.           setTimeout(stopGear, 1200);
  345.           setTimeout(deactivateAtom, 1400);
  346.           setTimeout(stopFans, 1600);
  347.           setTimeout(disableBackgroundPulse, 1800);
  348.         } else {
  349.           // Powering ON
  350.           this.classList.add('on');
  351.           gsap.to(this, { scale: 1.08, duration: 0.5, yoyo: true, repeat: 1 });
  352.           gsap.to(this, {
  353.             boxShadow: '0 0 20px rgba(255, 102, 0, 0.8)',
  354.             duration: 1,
  355.           });
  356.           gsap.to(statusText, { opacity: 1, duration: 1 });

  357.           // Delayed Startup Sequence
  358.           setTimeout(enableBackgroundPulse, 100);
  359.           setTimeout(turnOnLightbulbs, 500);
  360.           setTimeout(chargeBattery, 800);
  361.           setTimeout(startGear, 1200);
  362.           setTimeout(activateAtom, 1400);
  363.           setTimeout(startFans, 1600);
  364.         }
  365.       });
  366.     </script>
  367.   </body>
  368. </html>
复制代码


免责声明: 本站部分文章来自互联网收集,仅供用于学习和交流/测试,请遵循相关法律法规,本站一切资源不代表第柒论坛立场,如有侵权/违规/后门/不妥请联系本站管理员删除。敬请谅解!侵删请致信E-mail:ailm@hlye.cn
回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
高级模式
B Color Image Link Quote Code Smilies |上传

本版积分规则

快速回复 返回顶部 返回列表