js实现可调节参数属性的彩色正方形旋转发射动画效果代码
代码语言:html
所属分类:动画
代码描述:js实现可调节参数属性的彩色正方形旋转发射动画效果代码
代码标签: js 调节 参数 属性 彩色 正方形 旋转 发射 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Roboto&display=swap"); @property --degs { syntax: "<angle>"; initial-value: 0deg; inherits: false; } :root { --degs: 0deg; --incrementor: 0deg; --rotation: 0deg; } html, body { height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; background: black; font-family: "Roboto", sans-serif; } #container { height: inherit; width: inherit; display: flex; align-items: center; justify-content: center; } #container * { border-style: solid; position: absolute; border-image-slice: 1; border-image-source: linear-gradient( var(--degs), #1d9f9f, #0099b8, #008ed0, #007edd, #7165d4, #a254c3, #c53ea9, #dc2888, #eb3775, #f44b64, #f76154, #f67747 ); animation: 3s rotateMe linear infinite; transform: rotate(var(--rotation)); } @keyframes rotateMe { to { --degs: calc(360deg + var(--incrementor)); } } #controls { position: fixed; top: 0; right: 0; border: 1px solid white; width: 20vw; color: white; padding: 10px; } label { display: block; font-size: 0.75em; } #controls div:not(:first-child) label { padding-top: 16px; } input { appearance: none; width: 100%; display: inline-block; height: 3px; background-color: white; margin: 12px 0; color: white; } #numSquare:before { content: "1"; margin-top: 8px; display: block; } #numSquare:after { content: "100"; margin-top: 8px; display: block; } #border:before { content: "1"; margin-top: 8px; display: block; } #border:after { content: "20"; margin-top: 8px; display: block; } #space:before { content: "1"; margin-top: 8px; display: block; } #space:after { content: "100"; margin-top: 8px; display: block; } #numSquare:before { content: "1"; margin-top: 8px; display: block; } #numSquare:after { content: "100"; margin-top: 8px; display: block; } #degree:before { content: "0"; margin-top: 8px; display: block; } #degree:after { content: "359"; margin-top: 8px; display: block; } </style> </head> <body > <div id="container"></div> <div id="controls"> <div> <label> Number of Squares </label> <input id="numSquare" type="range" min="1" max="100" value="20" oninput="changeNum(this.value)"> </div> .........完整代码请登录后点击上方下载按钮下载查看
网友评论0