原生js+css布局模拟Ubuntu操作系统交互ui效果代码

代码语言:html

所属分类:布局界面

代码描述:原生js+css布局模拟Ubuntu操作系统交互ui效果代码,模拟命令行启动、输入密码,桌面设置、计算器、文件管理、浏览器、垃圾桶、命令行、记事本等,整个体验交互与真实的ubuntu操作系统没有区别,仿真度100%。

代码标签: 原生 js css 布局 模拟 Ubuntu 操作 系统 交互 ui

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ubuntu Web Desktop</title>
<!-- External Assets (Fonts & Icons only) -->
<link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&family=Ubuntu+Mono&display=swap" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.6.4.0.css">

<style>
    /* --- CSS VARIABLES & RESET --- */
    :root {
        --ub-orange: #E95420;
        --ub-aubergine: #2C001E;
        --ub-warm-grey: #AEA79F;
        --ub-cool-grey: #333333;
        --ub-icloud: #F7F7F7;
        --win-bg: #fafafaf0;
        --win-header: #e4e4e4;
        --glass-bg: rgba(20, 20, 20, 0.6);
        --glass-border: rgba(255, 255, 255, 0.1);
        --shadow-md: 0 10px 30px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.1);
        --radius-md: 12px;
        --radius-lg: 18px;
        --font-main: 'Ubuntu', sans-serif;
        --font-mono: 'Ubuntu Mono', monospace;
    }

    * { box-sizing: border-box; user-select: none; }
    body, html {
        margin: 0; padding: 0; width: 100vw; height: 100vh; overflow: hidden;
        font-family: var(--font-main); background: #000; color: #fff;
    }

    /* --- BOOT SEQUENCE & LOGIN --- */
    #boot-screen, #login-screen {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        z-index: 9999; display: flex; flex-direction: column;
        justify-content: center; align-items: center;
        transition: opacity 1s ease;
    }
    #boot-screen { background: #000; font-family: var(--font-mono); color: #ccc; align-items: flex-start; padding: 40px; }
    .bios-text { margin: 2px 0; }
    .ubuntu-spinner {
        border: 4px solid rgba(255,255,255,0.1); border-left-color: var(--ub-orange);
        border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite;
        position: absolute; top: 50%; left: 50%; margin-top: -25px; margin-left: -25px; display: none;
    }
    #login-screen {
        background: linear-gradient(rgba(44, 0, 30, 0.8), rgba(44, 0, 30, 0.9)), url('https://images.unsplash.com/photo-1451187580459-43490279c0fa?q=80&w=2072&auto=format&fit=crop') no-repeat center center/cover;
        backdrop-filter: blur(10px); display: none; opacity: 0;
    }
    .login-box { text-align: center; background: rgba(0,0,0,0.4); padding: 40px; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
    .user-avatar { width: 100px; height: 100px; border-radius: 50%; background: #fff url('https://api.dicebear.com/7.x/avataaars/svg?seed=Felix') center/cover; margin: 0 auto 20px; border: 3px solid rgba(255,255,255,0.2); }
    .login-input-group { display: flex; margin-top: 20px; justify-content: center;}
    #password-input { background: rgba(30,30,30,0.8); border: 1px solid #555; color: #fff; padding: 8px 12px; border-radius: 4px 0 0 4px; outline: none; font-family: var(--font-main); }
    #login-btn { background: var(--ub-orange); border: none; color: #fff; padding: 8px 15px; border-radius: 0 4px 4px 0; cursor: pointer; transition: 0.2s; }
    #login-btn:hover { filter: brightness(1.1); }

    /* --- DESKTOP ENVIRONMENT --- */
    #desktop {
        width: 100%; height: 100%; display: none; opacity: 0; transition: opacity 1s;
        background: url('https://images.unsplash.com/photo-1506703719100-a0f3a48c0f86?q=80&w=2070&auto=format&fit=crop') no-repeat center center / cover;
        overflow: hidden; position: relative;
    }

    /* Top Bar */
    #top-bar {
        height: 30px; background: #1d1d1d; display: flex; justify-content: space-between;
        align-items: center; padding: 0 15px; font-size: 14px; font-weight: 500;
        box-shadow: 0 2px 10px rgba(0,0,0,0.5); position: relative; z-index: 2000;
    }
    .bar-section { display: flex; align-items: center; gap: 15px; height: 100%; }
    #activities-btn { padding: 0 10px; height: 100%; display: flex; align-items: center; cursor: pointer; }
    #activities-btn:hover, .tray-icon:hover { background: rgba(255,255,255,0.1); }
    #clock { font-weight: bold; position: absolute; left: 50%; transform: translateX(-50%); cursor: default;}
    .tray-icon { padding: 0 8px; height: 100%; display: flex; align-items: center; cursor: pointer; gap: 8px;}

    /* Dock */
    #dock-container {
        position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
        height: auto; z-index: 1000;
    }
    #dock {
        background: rgba(35, 35, 35, 0.85); backdrop-filter: blur(15px);
        border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-lg);
        padding: 10px 6px; display: flex; flex-direction: column; gap: 12px;
        box-shadow: var(--shadow-md);
    }
    .dock-item {
        width: 48px; height: 48px; position: relative; cursor: pointer;
        transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
        display: flex; justify-content: center; align-items: center; font-size: 24px;
        background: rgba(255,255,255,0.05); border-radius: .........完整代码请登录后点击上方下载按钮下载查看

网友评论0