css+svg实现四种卡片变形动画效果代码
代码语言:html
所属分类:动画
代码描述:css+svg实现四种卡片变形动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { font-family: sans-serif; display: flex; gap: 2rem; justify-content: center; align-items: center; min-height: 100vh; background: #04d; overflow: hidden; } svg { background: #806; border-radius: 10%; } path { fill: #af5a; &:nth-child(odd) { fill: #fa5a; } } </style> </head> <body translate="no"> <svg xmlns="http://www.w3.org/2000/svg" width="240" height="240" viewBox="0 0 240 240"> <path d="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z" transform="rotate(30 120 120)"> <animate id="loop0_0" attributeName="d" dur="3s" repeatCount="indefinite" values="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 0,120 C 90,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z"></animate> <animate attributeName="d" begin="mouseover" dur="0.4s" fill="freeze" to="M 120,0 C 165,60 165,180 120,0 C 120,60 15,60 120,120 Z"></animate> </path> <path d="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z" transform="rotate(60 120 120)"> <animate id="loop0_1" attributeName="d" dur="3s" repeatCount="indefinite" values="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 0,120 C 90,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z"></animate> <animate attributeName="d" begin="mouseover" dur="0.4s" fill="freeze" to="M 120,0 C 165,60 165,180 120,0 C 120,60 15,60 120,120 Z"></animate> </path> <path d="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z" transform="rotate(90 120 120)"> <animate id="loop0_2" attributeName="d" dur="3s" repeatCount="indefinite" values="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 0,120 C 90,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z"></animate> <animate attributeName="d" begin="mouseover" dur="0.4s" fill="freeze" to="M 120,0 C 165,60 165,180 120,0 C 120,60 15,60 120,120 Z"></animate> </path> <path d="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z" transform="rotate(120 120 120)"> <animate id="loop0_3" attributeName="d" dur="3s" repeatCount="indefinite" values="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 0,120 C 90,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z"></animate> <animate attributeName="d" begin="mouseover" dur="0.4s" fill="freeze" to="M 120,0 C 165,60 165,180 120,0 C 120,60 15,60 120,120 Z"></animate> </path> <path d="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z" transform="rotate(150 120 120)"> <animate id="loop0_4" attributeName="d" dur="3s" repeatCount="indefinite" values="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 0,120 C 90,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z"></animate> <animate attributeName="d" begin="mouseover" dur="0.4s" fill="freeze" to="M 120,0 C 165,60 165,180 120,0 C 120,60 15,60 120,120 Z"></animate> </path> <path d="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z" transform="rotate(180 120 120)"> <animate id="loop0_5" attributeName="d" dur="3s" repeatCount="indefinite" values="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 0,120 C 90,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z"></animate> <animate attributeName="d" begin="mouseover" dur="0.4s" fill="freeze" to="M 120,0 C 165,60 165,180 120,0 C 120,60 15,60 120,120 Z"></animate> </path> <path d="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z" transform="rotate(210 120 120)"> <animate id="loop0_6" attributeName="d" dur="3s" repeatCount="indefinite" values="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 0,120 C 90,60 150,180 120,0 C 120,60 30,60 120,120 Z; M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z"></animate> <animate attributeName="d" begin="mouseover" dur="0.4s" fill="freeze" to="M 120,0 C 165,60 165,180 120,0 C 120,60 15,60 120,120 Z"></animate> </path> <path d="M 120,0 C 150,60 150,180 120,0 C 120,60 30,60 120,120 Z" transform="rotate(240 120 120)"> <animate id="loop0_7" attributeName="d" dur="3.........完整代码请登录后点击上方下载按钮下载查看
网友评论0