svg+js实现此消彼长动画效果代码
代码语言:html
所属分类:动画
代码描述:svg+js实现此消彼长动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> :root { --one:#bdd7ff; --two:#4c94ff; --three:#103064; } body { background-color: var(--one); margin: 0; } svg { height: 100vh; width: 100%; display: block; } rect[y="0"] { fill: var(--two); } rect[y="100"] { fill: var(--one); } path { transition: 0.35s cubic-bezier(0.3, 0.2, 0.1, 1.4); fill: none; stroke: var(--two); stroke-width: 10; stroke-linejoin: round; stroke-linecap: round; } #floor { stroke: url(#one); } rect[y="100"] { fill: url(#one); } #roof { stroke: url(#two); } rect[y="0"] { fill: url(#two); } #one :first-child { stop-color: var(--one); } #one :last-child { stop-color: var(--two); } #two :first-child { stop-color: var(--two); } #two :last-child { stop-color: var(--three); } </style> </head> <body> <svg viewBox="0 0 190 200" preserveAspectRatio="xMidYMid slice" ; style="position:fixed; top:0;"> <linearGradient id="one" x1="0%" x2="100%" y1="0%" y2="100%" gradientUnits="userSpaceOnUse"> <stop offset="0" /> <stop offset="1" /> </linearGradient> <linearGradient id="two" x1="0%" x2="100%" y1="0%" y2="100%" gradientUnits="userSpaceOnUse"> <stop offset="0" /> <stop offset="1" /> </linearGradient> <g transform="translate(50, -70) rotate(30) scale(1.3)"> <rect x="0" y=".........完整代码请登录后点击上方下载按钮下载查看
网友评论0