css+js布局实现当前时间的指针走动的时钟效果代码
代码语言:html
所属分类:布局界面
代码描述:css+js布局实现当前时间的指针走动的时钟效果代码
代码标签: css js 布局 当前 时间 指针 走动 时钟
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> * { box-sizing: border-box; } :root { --color-bg-top-left: #474447; --color-bg-bottom-right: #0E0E0E; --color-shadow: #080606; --color-numerals: #CFD8DF; --color-dial-base: #060201; --color-dial-highlight: #D3DADE; --dim-max-width: 800px; --dim-min-width: calc(100vw - 40px); --font-size-numerals: min(5vw, 38px); --dim-clock-size: min(var(--dim-max-width), var(--dim-min-width)); --dim-numerals-offset: calc(var(--dim-clock-size) * -0.415); --dim-dash-offset: calc(var(--dim-clock-size) * -0.462); --dim-dash-size: calc(var(--dim-clock-size) * 0.023); --dim-center-size:calc(var(--dim-clock-size) * 0.048); --dim-dash-width: calc(var(--dim-dash-size) * 0.2); --dim-hour-hand-height: calc(var(--dim-clock-size) * 0.3); --dim-hour-hand-width: calc(var(--dim-hour-hand-height) * 0.07); --dim-minute-hand-height: calc(var(--dim-clock-size) * 0.37); --dim-minute-hand-width: var(--dim-hour-hand-width); --dim-second-hand-height: calc(var(--dim-clock-size) * 0.48); --dim-second-hand-width: calc(var(--dim-second-hand-height) * 0.02); --dim-inner-rim-size: 76%; } body, html { padding: 0; margin: 0; background-color: #ccc; display: flex; align-items: center; justify-content: center; width: 100vw; height: 100vh; } .clock { position: relative; aspect-ratio: 1; flex: 1; max-width: var(--dim-clock-size); border-radius: 50%; background-image: linear-gradient(to bottom right, var(--color-bg-top-left), var(--color-bg-bottom-right) 60%); border: 2px solid var(--color-bg-bottom-right); box-shadow: inset 1px 1px 1px 0px rgba(255, 255, 255, 0.25); overflow: hidden; } .outer-rim { position: absolute; top: 0; left: 0; right: 0; bottom: 0; position: absolute; margin: auto; width: 97%; aspect-ratio: 1; border-radius: 50%; background-color: transparent; box-shadow: inset 3px 3px 24px 16px var(--color-shadow); } .outer-rim { position: absolute; top: 0; left: 0; right: 0; bottom: 0; position: absolute; margin: auto; wid.........完整代码请登录后点击上方下载按钮下载查看
网友评论0