gsap实现一个拖动恒温控制器效果代码
代码语言:html
所属分类:拖放
代码描述:gsap实现一个拖动恒温控制器效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&display=swap'> <style> * { border: 0; box-sizing: border-box; margin: 0; padding: 0; } :root { --l1: hsl(223,10%,100%); --l2: hsl(223,10%,95%); --l3: hsl(223,10%,90%); --l4: hsl(223,10%,85%); --l5: hsl(223,10%,80%); --l6: hsl(223,10%,75%); --text: hsl(223,10%,20%); font-size: calc(16px + (24 - 16) * (100vw - 320px) / (1280 - 320)); } body { background: var(--l5); color: var(--text); display: grid; place-items: center; font: 1em/1.5 Nunito, sans-serif; height: 100vh; } .temp { --angle: 0deg; background-color: var(--l3); border-radius: 3em; box-shadow: 0 0.25em 0.5em hsla(0,0%,0%,0.1); display: flex; flex-direction: column; justify-content: center; margin: 1.5em 0; padding: 2em; width: 16em; height: 28.4em; } .temp__dial, .temp__dial-core, .temp__dial-shades, .temp__shade-cold, .temp__shade-hot, .temp__drag, .temp__drag:before { border-radius: 50%; } .temp__dial { box-shadow: 0.5em 0.5em 1em var(--l6), -0.5em -0.5em 1em var(--l1); margin-bottom: 2.5em; position: relative; width: 12em; height: 12em; } .temp__dial-core, .temp__dial-shades, .temp__shade-cold, .temp__shade-hot, .temp__value, .temp__drag, .temp__drag:before { position: absolute; } .temp__dial-core, .temp__dial-shades, .temp__value, .temp__drag:before { top: 50%; left: 50%; } .temp__dial-core, .temp__dial-shades, .temp__value { transform: translate(-50%,-50%); } .temp__dial-core, .temp__dial-shades, .temp__value { transition: all 0.2s ease-in-out; } .temp__dial-core, .temp__dial-shades { transition-delay: 0.1s; width: 8.5rem; height: 8.5rem; } .temp__dial-core { box-shadow: 0 0.2rem 0.5rem 0.1rem inset; color: hsla(0,0%,0%,0.1); } .temp__dial-shades, .temp__drag:before { opacity: 0; } .temp__shade-cold, .temp__shade-hot, .temp__drag { width: 100%; heigh.........完整代码请登录后点击上方下载按钮下载查看
网友评论0