js+css实现一个半环形测量仪器数字变化效果代码
代码语言:html
所属分类:其他
代码描述:js+css实现一个半环形测量仪器数字变化效果代码,拖动下面的range滑块。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> * { box-sizing: border-box; } :root { --color: hsl(10 80% 50%); --thickness: 2rem; } body { accent-color: var(--color); display: grid; place-items: center; min-height: 100vh; align-content: center; gap: 4rem; } .gauge { display: grid; place-items: center; align-content: end; padding: 1rem; width: 260px; aspect-ratio: 2 / 1; position: relative; overflow: hidden; } .gauge::after { box-sizing: border-box; content: ""; position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 1; border: var(--thickness) solid transparent; border-radius: 50%; /* background: conic-gradient( from 270deg, hsl(240 80% 50%) 0 calc(50% * var(--progress, 0)), transparent calc(50% * var(--progress, 0)) ), black; */ background: linear-gradient(90deg, var(--color) 50%, transparent 50%), black; background-size: calc(100% + (var(--thickness) * 2)) calc(100% + (var(--thickness) * 2)); background-position: calc(var(--thickness) * -1) calc(var(--thickness) * -1); .........完整代码请登录后点击上方下载按钮下载查看
网友评论0