js+css布局实现简洁清爽质感的圆形时钟显示时间效果代码
代码语言:html
所属分类:布局界面
代码描述:js+css布局实现简洁清爽质感的圆形时钟显示时间效果代码
代码标签: js css 布局 简洁 清爽 质感 圆形 时钟 显示 时间
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> /* Custom CSS properties for light angle animations */ @property --primary-light-angle { syntax: "<angle>"; inherits: false; initial-value: -75deg; } @property --dark-edge-angle { syntax: "<angle>"; inherits: false; initial-value: 105deg; } :root { --minute-marker-opacity: 1; --inner-shadow-opacity: 1; --outer-shadow-opacity: 1; --reflection-opacity: 0.5; --glossy-opacity: 0.3; --hour-number-opacity: 1; --hour-number-color: rgba(50, 50, 50, 0.9); --minute-marker-color: rgba(80, 80, 80, 0.5); --hand-color: rgba(50, 50, 50, 0.9); --second-hand-color: rgba(255, 107, 0, 1); --shadow-layer1-opacity: 0.1; --shadow-layer2-opacity: 0.1; --shadow-layer3-opacity: 0.1; } body { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: rgba(215, 215, 215, 1); font-family: "Inter", -apple-system, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow: hidden; } .inspiration { position: fixed; top: 20px; text-align: center; font-size: 14px; color: rgba(50, 50, 50, 0.8); z-index: 100; } .inspiration a { color: rgba(50, 50, 50, 0.9); text-decoration: none; transition: color 0.3s ease; } .inspiration a:hover { color: rgba(0, 0, 0, 0.9); text-decoration: underline; } .glass-clock-container { position: relative; width: 350px; height: 350px; display: flex; justify-content: center; align-items: center; z-index: 2; margin-top: 20px; } /* Glass effect wrapper */ .glass-effect-wrapper { position: relative; z-index: 2; border-radius: 50%; background: transparent; pointer-events: none; transition: all 400ms cubic-bezier(0.25, 1, 0.5, 1); perspective: 1000px; transform-style: preserve-3d; -webkit-backface-visibility: hidden; backface-visibility: hidden; will-change: transform; } /* Shadow container - OUTER SHADOW */ .glass-effect-shadow { --shadow-offset: 3em; position: absolute; width: calc(100% + var(--shadow-offset)); height: calc(100% + var(--shadow-offset)); top: calc(0% - var(--shadow-offset) / 2); left: calc(0% - var(--shadow-offset) / 2); filter: blur(10px); -webkit-filter: blur(10px); pointer-events: none; z-index: 1; transition: all 400ms cubic-bezier(0.25, 1, 0.5, 1); opacity: 1; } /* Shadow effect - softened with multiple layers */ .glass-effect-shadow::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2)); width: calc(100% - var(--shadow-offset) - 0.25em); height: calc(100% - var(--shadow-offset) - 0.25em); top: calc(var(--shadow-offset) - 0.5em); left: calc(var(--shadow-offset) - 0.875em); padding: 0.125em; box-sizing: border-box; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; overflow: visible; opacity: 0.8; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05), 0 15px 25px rgba(0, 0, 0, 0.05), 0 20px 40px rgba(0, 0, 0, 0.05); } .glass-clock-face { --border-width: clamp(2px, 0.0625em, 4px); position: relative; width: 350px; height: 350px; border-radius: 50%; background-color: rgba(255, 255, 255, 0.03); background-image: linear-gradient( -75deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01) ); /* Blur effect moved directly to the clock face */ backdrop-filter: blur(1px); -webkit-backdrop-filter: blur(1px); box-shadow: inset 0 0.4em 0.4em rgba(0, 0, 0, 0.1), inset 0 -0.4em 0.4em rgba(255, 255, 255, 0.5), 10px 5px 10px rgba(0, 0, 0, var(--shadow-layer1-opacity)), 10px 20px 20px rgba(0, 0, 0, var(--shadow-layer2-opacity)), 10px 55px 50px rgba(0, 0, 0, var(--shadow-layer3-opacity)); z-index: 3; overflow: hidden; pointer-events: auto; cursor: pointer; transition: all 400ms cubic-bezier(0.25, 1, 0.5, 1); user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; transform-style: preserve-3d; -webkit-backface-visibility: hidden; backface-visibility: hidden; will-change: transform, box-shadow; } /* Enhanced clock border effect with improved glossy edges based on the provided CSS */ .glass-clock-face::after { content: ""; position: absolute; z-index: 10; inset: 0; border-radius: 50%; width: calc(100% + var(--border-width)); height: calc(100% + var(--border-width)); top: calc(0% - var(--border-width) / 2); left: calc(0% - var(--border-width) / 2); padding: var(--border-width); box-sizing: border-box; background: conic-gradient( from var(--primary-light-angle) at 50% 50%, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.2) 5% 40%, rgba(255, 255, 255, 1) 50%, rgba(255, 255, 255, 0.2) 60% 95%, rgba(255, 255, 255, 1) ), linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.5)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; box-shadow: inset 0 0 0 calc(var(--border-width) / 2) rgba(255, 255, 255, 0.9), 0 0 12px rgba(255, 255, 255, 0.8); transition: all 400ms cubic-bezier(0.25, 1, 0.5, 1), --primary-light-angle 500ms ease; opacity: 0.9; will-change: background, box-shadow; } /* Edge highlight ring */ .glass-edge-highlight { position: absolute; width: 350px; height: 350px; border-radius: 50%; top: 0; left: 0; border: 1px solid rgba(255, 255, 255, 0.8); box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); z-index: 8; pointer-events: none; opacity: 0.6; } /* Enhanced edge highlight ring with increased glossiness */ .glass-edge-highlight-outer { position: absolute; width: 356px; height: 356px; border-radius: 50%; top: -3px; left: -3px; border: 1px solid rgba(255, 255, 255, 0.7); box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); z-index: 7; pointer-events: none; opacity: 0.6; } /* Dark edge shadow for bottom-right contrast - INNER SHADOW */ .........完整代码请登录后点击上方下载按钮下载查看
网友评论0