js实现mac ui删除文件碎纸机效果代码

代码语言:html

所属分类:其他

代码由gemini-4 ai生成,可能有错误,仅供参考:点击查看提示词

代码描述:mac ui删除文件碎纸机效果

代码标签: js mac ui 删除 文件 碎纸机 效果 代码

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

<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>macOS Desktop - S-01 DARK 碎纸机</title>
  <style>
    :root {
      --menubar-h: 28px;
      --dock-h: 72px;
      --shredder-bg: #1e2228;
      --shredder-panel: #14171c;
      --accent-orange: #ff6a2b;
      --accent-amber: #ff9d42;
      --text-main: #f3f6fa;
      --text-dim: #8a94a6;
    }

    * {
      box-sizing: border-box;
      user-select: none;
      -webkit-user-select: none;
    }

    html, body {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
      color: var(--text-main);
      background: #2f7d84;
    }

    /* macOS 壁纸背景(带参考图斜向微立体方格质感) */
    .desktop {
      position: relative;
      width: 100vw;
      height: 100vh;
      background:
        radial-gradient(circle at 20% 20%, rgba(126, 218, 224, 0.45) 0%, transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(17, 75, 89, 0.65) 0%, transparent 55%),
        linear-gradient(135deg, #56a8ae 0%, #3d8b94 48%, #245f69 100%);
      overflow: hidden;
    }

    .desktop-grid-overlay {
      position: absolute;
      inset: -20%;
      pointer-events: none;
      opacity: 0.24;
      background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.22) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
      background-size: 28px 28px;
      transform: perspective(900px) rotateX(18deg) rotateZ(-8deg);
      mask-image: radial-gradient(ellipse at 45% 45%, rgba(0,0,0,0.9) 10%, rgba(0,0,0,0.15) 75%);
    }

    /* 顶部 macOS 菜单栏 */
    .menubar {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: var(--menubar-h);
      padding: 0 14px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: rgba(18, 26, 30, 0.42);
      backdrop-filter: blur(22px) saturate(160%);
      -webkit-backdrop-filter: blur(22px) saturate(160%);
      border-bottom: 1px solid rgba(255, 255, 255, 0.12);
      font-size: 13px;
      z-index: 1000;
      color: rgba(255, 255, 255, 0.94);
    }

    .menubar-left, .menubar-right {
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .menu-item {
      cursor: default;
      padding: 2px 6px;
      border-radius: 4px;
      transition: background 0.15s;
    }

    .menu-item:hover {
      background: rgba(255, 255, 255, 0.16);
    }

    .menu-item.bold {
      font-weight: 600;
    }

    .apple-logo {
      font-size: 15px;
      line-height: 1;
    }

    .sound-toggle {
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 8px;
      border-radius: 5px;
      background: rgba(255, 255, 255, 0.1);
      font-size: 12px;
      border: 1px solid rgba(255, 255, 255, 0.14);
    }

    .sound-toggle:hover {
      background: rgba(255, 255, 255, 0.2);
    }

    /* 桌面工作区与文件图标 */
    .desktop-area {
      position: absolute;
      top: var(--menubar-h);
      left: 0;
      right: 0;
      bottom: 0;
    }

    .desktop-hint {
      position: absolute;
      left: 24px;
      bottom: 94px;
      padding: 8px 14px;
      border-radius: 10px;
      background: rgba(12, 20, 24, 0.42);
      backdrop-filter: blur(12px);
      border: 1px solid rgba(255, 255, 255, 0.12);
      font-size: 12px;
      color: rgba(255, 255, 255, 0.85);
      pointer-events: none;
      line-height: 1.5;
    }

    .desktop-file {
      position: absolute;
      width: 96px;
      padding: 8px 6px 6px;
      border-radius: 10px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      cursor: grab;
      transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
      z-index: 10;
    }

    .desktop-file:hover {
      background: rgba(255, 255, 255, 0.14);
    }

    .desktop-file.selected {
      background: rgba(45, 130, 255, 0.34);
      box-shadow: 0 0 0 1px rgba(130, 190, 255, 0.65);
    }

    .desktop-file.dragging {
      cursor: grabbing;
      z-index: 800;
      transform: scale(1.06);
      opacity: 0.92;
      filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.4));
      transition: none;
    }

    .file-icon-box {
      position: relative;
      width: 56px;
      height: 62px;
      border-radius: 8px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      padding: 7px;
      box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
      overflow: hidden;
    }

    .file-icon-box::after {
      content: "";
      position: absolute;
      top: 0;
      right: 0;
      width: 14px;
      height: 14px;
      background: linear-gradient(225deg, rgba(0, 0, 0, 0.18) 50%, rgba(255, 255, 255, 0.45) 50%);
      border-bottom-left-radius: 4px;
    }

    .file-icon-box.is-dir {
      border-radius: 4px 8px 8px 8px;
      height: 50px;
      width: 60px;
      margin-top: 8px;
    }

    .file-icon-box.is-dir::before {
      content: "";
      position: absolute;
      top: -6px;
      left: 0;
      width: 24px;
      height: 8px;
      background: inherit;
      border-radius: 4px 4px 0 0;
      filter: brightness(0.92);
    }

    .file-icon-box.is-dir::after {
      display: none;
    }

    .file-lines {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-top: 4px;
      opacity: 0.35;
    }

    .file-lines span {
      display: block;
      height: 3px;
      border-radius: 2px;
      background: #1a2230;
    }

    .file-badge {
      align-self: flex-end;
      font-size: 9px;
      font-weight: 800;
      letter-spacing: 0.4px;
      padding: 2px 5px;
      border-radius: 4px;
      background: rgba(0, 0, 0, 0.22);
      color: #fff;
      text-shadow: 0 1px 1px rgba(0,0,0,0.3);
    }

    .file-name {
      width: 100%;
      font-size: 12px;
      line-height: 1.28;
      text-align: center;
      color: #ffffff;
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.78);
      word-break: break-all;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      padding: 1px 3px;
      border-radius: 4px;
    }

    .desktop-file.selected .file-name {
      background: #0a66e6;
      text-shadow: none;
    }

    /* ==========================================
       S-01 DARK 碎纸机组件 (参考图拟物工业风)
       =======================.........完整代码请登录后点击上方下载按钮下载查看

网友评论0