js+css实现彩虹文字渐变动画效果代码
代码语言:html
所属分类:其他
代码描述:js+css实现彩虹文字渐变动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/tailwind.2.2.7.css"> <style> :root { --bg-pos-x: 0; --animation-duration: 20s; --bg-size-x: 20em; } /* I can't use tailwind.config.js in CodePen, so I add my classes */ .leading-huge-text { line-height: 0.9; } .grid-rows-min { grid-template-rows: repeat(auto-fill, -webkit-min-content); grid-template-rows: repeat(auto-fill, min-content); } .current-color { accent-color: rgba(130, 221, 53, 1); } /* corresponds to tailwind md size */ @media (max-width: 768px) { .current-color { accent-color: rgba(235, 174, 15, 1); } } .bg-rainbow { background-size: var(--bg-size-x) 100%; background-image: linear-gradient( 90deg, rgba(255, 0, 0, 1) 0%, rgba(255, 154, 0, 1) 10%, rgba(208, 222, 33, 1) 20%, rgba(79, 220, 74, 1) 30%, rgba(63, 218, 216, 1) 40%, rgba(47, 201, 226, 1) 50%, rgba(28, 127, 238, 1) 60%, rgba(95, 21, 242, 1) 70%, rgba(186, 12, 248, 1) 80%, rgba(251, 7, 217, 1) 90%, rgba(255, 0, 0, 1) 100% ); } .animate-hue { -webkit-animation: animate-hue var(--animation-duration) infinite linear; animation: animate-hue var(--animation-duration) infinite linear; } .animate-bg { -webkit-animation: animate-bg var(--animation-duration) infinite linear; animation: animate-bg var(--animation-duration) infinite linear; } @-webkit-keyframes animate-bg { from { background-position: calc(var(--bg-pos-x) * var(--text-w)) 0; } to { background-position: calc( 100% - var(--text-w) + calc(var(--bg-pos-x) * var(--text.........完整代码请登录后点击上方下载按钮下载查看
网友评论0