js+svg实现泡泡钟点击手动排序效果代码
代码语言:html
所属分类:其他
代码描述:js+svg实现泡泡钟点击手动排序效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Noto+Sans:wght@600&display=swap'> <style> body { margin: 0; height: 100vh; display: flex; flex-direction: column; background: #444; } svg.passive * { transition: none !important; } marker { fill: #a05cc6; overflow: visible; } #swap { fill: none; stroke: #a05cc6; stroke-width: 2; marker-end:url(#arrow); } #swap circle { opacity: 0; } #swapper use { transform-origin: 0px 0px; opacity: 0; pointer-events: none; } #swapper use[data-low] { opacity: 0.7; pointer-events: all; cursor: pointer; } #swapper use[data-low]:hover { opacity: 1; } #outer { filter: url(#blob); } #outer>g { transform-origin: 0px 0px; transition: transform 0.5s ease-in-out; } #outer circle { r: 9px; cy: -50px; fill: rgb(0 0 0 / 0); stroke: #8f22cc; stroke-width: 2; } #outer path { d: path('M0-60C3.3-60 6.1-58.4 8-56 9.6-54.1 10.2-51.5 10-49 9.8-47.2 9.1-45.4 8-44 6.1-41.6 3.3-40 0-40-3.3-40-6.1-41.6-8-44-9.1-45.4-9.8-47.2-10-49-10.2-51.5-9.6-54.1-8-56-6.1-58.4-3.3-60 0-60z'); fill: #d4941c; transition: d 0.3s 0.1s ease-in-out; } #outer .before path { d: path('M0-60C3.3-60 6.1-58.4 8-56 9.6-54.1 14.2-50.6 13.5-48.2 13-46.5 9.1-45.4 8-44 6.1-41.6 3.3-40 0-40-3.3-40-6.1-41.6-8-44-9.1-45.4-9.8-47.2-10-49-10.2-51.5-9.6-54.1-8-56-6.1-58.4-3.3-60 0-60z') } #outer .after path { d: path('M0-60C3.3-60 6.1-58.4 8-56 9.6-54.1 10.2-51.5 10-49 9.8-47.2 9.1-45.4 8-44 6.1-41.6 3.3-40 0-40-3.3-40-6.1-41.6-8-44-9.1-45.4-13-46.5-13.5-48.2-14.2-50.6-9.6-54.1-8-56-6.1-58.4-3.3-60 0-60z') } #outer .before.after path { d: path('M0-60C3.3-60 6.1-58.4 8-56 9.6-54.1 14.2-50.6 13.5-48.2 13-46.5 9.1-45.4 8-44 6.1-41.6 3.3-40 0-40-3.3-40-6.1-41.6-8-44-9.1-45.4-13-46.5-13.5-48.2-14.2-50.6-9.6-54.1-8-56-6.1-58.4-3.3-60 0-60z') } #outer text { fill: white; font-family: 'Noto Sans'; font-size: 9.5px; text-anchor: middle; transform-origin: 0px -50px; transition: transform 0.5s ease-in-out; } svg #clock { stroke: #fff; stroke-width: 2; stroke-linecap: round; opacity: 0; transition: opacity 1s ease-in; } svg.finished #clock { opacity: 1; } @keyframes round { from {transform: rotate(0deg)} to {transform: rotate(360deg)} } </style> </head> <body translate="no"> <svg viewBox="-80 -80 160 160" xmlns="http://www.w3.org/2000/svg"> <filter id="blob" style="color-interpolation-filters:sRGB"> <feGaussianBlur stdDeviation="4"/> <feComponentTransfer result="cutoff"> <feFuncR tableValues="0.83" type="discrete"/> <feFuncG tableValues="0.58" type="discrete"/> <feFuncB tableValues="0.11" type="discrete"/> <feFuncA intercept="-9" slope="19" type="linear"/> </feComponentTransfer> <feComposite operator="over" in="SourceGraphic" in2="cutoff"/> </filter> <marker id="arrow" markerUnits="strokeWidth" orient="auto"> <path d="M -1,0 L -2,1.6 L 1,0 L-2,-1.6 z" /> </marker> <defs> <g id="swap"> <path d="M -8.5,-60.4 A 14,15 0 0 1 8.5,-60.4"/> <path d="M 8,-36.2 A 14,15 0 0 1 -8,-36.2"/> <circle r="15" cy="-50"/> </g> </defs> <g id="swapper"> <use href="#swap" transform="rotate(15)"/> <use href="#swap" transform="rotate(45)"/> <use href="#swap" transform="rotate(75)"/> <use href="#swap" transform="rotate(105)"/> <use href="#swap" transform="rotate(135)"/> <use href="#swap" transform="rotate(165)"/> <use href="#swap" transform="rotate(195)"/> <use href="#swap" transform="rotate(225)"/> <use href="#swap" transform="rotate(255)"/> <use href="#swap" transform="rotate(285)"/> <use href="#swap" transform="rotate(315)"/> <use href="#swap" transform="rotate(345)"/> </g> <g id="outer"> <g id="at1"><path/><text y="-47">1</text><circle/></g> <g id="at2"><path/><text y="-47">2</text><circle/></g> <g id="at3"><path/><text y="-47">3</text><circle/></g> <g id="at4"><path/><text y="-47">4</text><circle/></g> <g id=&q.........完整代码请登录后点击上方下载按钮下载查看
网友评论0