js+css实现页面滚动驱动齿轮转动动画效果代码
代码语言:html
所属分类:加载滚动
代码描述:js+css实现页面滚动驱动齿轮转动动画效果代码
代码标签: js css 页面 滚动 驱动 齿轮 转动 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url('https://fonts.googleapis.com/css2?family=Gloria+Hallelujah&display=swap'); @layer normalize, base, demo; @layer demo { body { height: 500vh; } html { color-scheme: light dark; } [data-theme='light'] { color-scheme: light only; } [data-theme='dark'] { color-scheme: dark only; } .arrow { position: fixed; left: 9rem; top: 12rem; width: 70px; z-index: 9999; } .arrow svg { width: 70px; scale: -1 1; } .arrow label { font-family: 'Gloria Hallelujah', cursive; position: absolute; left: 110%; top: 50%; } h1 { --font-level: 5; position: fixed; top: 50%; left: 50%; translate: -50% -50%; margin: 0; white-space: nowrap; } .gears { width: 100px; aspect-ratio: 1 / 2; position: fixed; top: 5.5rem; left: 1.5rem; container-type: inline-size; } .gears__box { position: absolute; inset: 0; overflow: hidden; background: light-dark(hsl(0 0% 15%), hsl(0 0% 0%)); } .gears::before { content: ''; position: absolute; inset: -10px; z-index: -1; background: radial-gradient( circle at center, light-dark(hsl(0 0% 75%), hsl(0 0% 50%)) 2px, transparent 2px ) 50% 50% / 54px 52px, color-mix(in lch, canvas, hsl(0 0% 100% / 0.2)); } .gears::after { content: ''; position: absolute; inset: 0; background: hsl(0 0% 100% / 0.2); -webkit-mask: linear-gradient( 135deg, #0000 30%, #000 20% 40%, #0000 40% 45%, #000 45% 50%, #0000 50% ); mask: linear-gradient( 135deg, #0000 30%, #000 20% 40%, #0000 40% 45%, #000 45% 50%, #0000 50% ); -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px); } .gears svg path { stroke: light-dark(hsl(0 0% 75%), hsl(0 0% 50%)); } .gears svg { position: absolute; -webkit-animation: rotate linear both; animation: rotate linear both; animation-timeline: scroll(root); --rotation: 720; aspect-ratio: 1; } .gears svg:nth-of-type(1) { width: .........完整代码请登录后点击上方下载按钮下载查看
网友评论0