吃鸡游戏
SVG SMILE 解决方案values = ""球弹跳的可变量可以在动画命令的属性中设置animateTransform。可以使用属性值来控制每个时间段的球速keyTimes。restart = "whenNotActive"- 防止重新启动动画直到它完全完成。单击后将开始动画<svg id="svg1" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200" viewBox="0 0 200 200" preserveAspectRatio="xMinYMin meet" style="border:1px solid" > <image xlink:href="https://i.stack.imgur.com/hXyA5.png" x="82" width="25px" height="25px" > <animateTransform id="anT" attributeName="transform" type="translate" dur="3s" begin="svg1.click+0.5s" values=" 0,0; 0,168; 0,84; 0,168; 0,126; 0,168; 0,148; 0,168; 0,158; 0,168; 0,163; 0,168; 0,166; 0,168;" keyTimes="0;0.066;0.13;0.198;0.264;0.33;0.396;0.462;0.528;0.594;0.66;0.726;0.792;1" repeatCount="1" fill="freeze" restart="whenNotActive" /></image> <polyline points="5,193 194,193" stroke="silver" stroke-width="4" /> </svg>循环动画示例为此,在动画开始条件中写入以下条件:begin = "svg1.click; anT.end + 1s",其中svg1.click- 单击后动画的第一次开始anT.end + 1s- 在 id = "anT" 的动画结束后 1 秒内重新启动动画<svg id="svg1" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200" viewBox="0 0 200 200" preserveAspectRatio="xMinYMin meet" style="border:1px solid" > <image xlink:href="https://i.stack.imgur.com/hXyA5.png" x="82" width="25px" height="25px" > <animateTransform id="anT" attributeName="transform" type="translate" dur="3s" begin="svg1.click+0.5s;anT.end+1s" values=" 0,0; 0,168; 0,84; 0,168; 0,126; 0,168; 0,148; 0,168; 0,158; 0,168; 0,163; 0,168; 0,166; 0,168; " keyTimes="0;0.066;0.13;0.198;0.264;0.33;0.396;0.462;0.528;0.594;0.66;0.726;0.792;1" repeatCount="1" fill="freeze" restart="whenNotActive" /></image> <polyline points="5,193 194,193" stroke="silver" stroke-width="4" /> </svg>