svg+css实现剪刀时钟动画效果代码
代码语言:html
所属分类:动画
代码描述:svg+css实现剪刀时钟动画效果代码,周围有刻度,没有实现显示当前时间功能。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { height: 100vh; margin: 0; display: grid; place-items: center; background: #242232; } svg { width: 50vmin; height: 50vmin; display: block; margin: auto; } svg * { stroke: white; fill: none; stroke-width: 1; } /* Container rotates like a clock hand */ .scissors-container { transform-origin: 100px 100px; animation: rotateClockwise 60s linear infinite; } /* Individual blades open and close */ .blade-left { transform-origin: 100px 100px; animation: openCloseLeft 1s cubic-bezier(0.4, 0, 0.6, 1) infinite; } .blade-right { transform-origin: 100px 100px; animation: openCloseRight 1s cubic-bezier(0.4, 0, 0.6, 1) infinite; } @keyframes rotateClockwise { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } @keyframes openCloseLeft { 0%, 30%, 100% { transform: rotate(0deg); } 90% { transform: rotate(-20deg); } } @keyframes openCloseRight { 0%, 30%, 100% { transform: rotate(0deg); } 90% { transform: rotate(20deg); } } </style> </head> <body translate="no"> <svg viewBox="0 0 200 200" width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <circle cx="100" cy="100" r="90"></circle> <g transform="rotate(0 100 100)"> <line x1="100" y1="12" x2="100" y2="24"></line> </g> <g transform="rotate(6 100 100)"> <line x1="100" y1="12" x2="100" y2="16"></line> </g> <g transform="rotate(12 100 100)"> <line x1="100" y1="12" x2="100" y2="16"></line> </g> <g transform="rotate(18 100 100)"> <lin.........完整代码请登录后点击上方下载按钮下载查看
网友评论0