简体   繁体   English

持续时间之间SVG的添加剂=“和”有什么区别

[英]What is the difference of SVG's additive=“sum” between duration

The difference of the following code? 以下代码的区别?

Why the result is different from? 为什么结果不同?

I thought it was the same. 我以为是一样的。

However, different results when the cell actually animation. 但是,当单元实际动画时,结果不同。

 <svg width="1000" height="1000"> <circle cx="10" cy="10" r="10"> <animate attributeType="XML" attributeName="cx" dur="10s" values="100; 200; 100" repeatCount="indefinite" /> <animate attributeType="XML" attributeName="cx" dur="10s" values="0; 300; 0" repeatCount="indefinite" additive="sum" /> </circle> </svg> 


 <svg width="1000" height="1000"> <circle cx="10" cy="10" r="10"> <animate attributeType="XML" attributeName="cx" dur="19s" values="100; 200; 100" repeatCount="indefinite" /> <animate attributeType="XML" attributeName="cx" dur="1s" values="0; 300; 0" repeatCount="indefinite" additive="sum" /> </circle> </svg> 

Its not the time thats additive, if thats what you think, its the value of the attribute (cx). 它不是时间的累加,如果这就是您的想法,则不是属性(cx)的值。

As you have 2 animations running at the same time, cx will build up as a combination of whatever the values of cx are on each animation. 由于您同时运行2个动画,因此cx将作为每个动画上cx值的组合而建立。

On the 2nd example. 在第二个示例中。 As one of the animations is only 1 second long, it will fluctuate very fast, on top of a slower animation. 由于其中一个动画只有1秒长,因此它会在较慢的动画之上快速波动。

If you forget about the additive for the moment, and just replace the 2nd cx value with cy on both, you will see why the animations are fundamentally different as well. 如果您暂时忘记了添加剂,只需将两个第二个cx值都替换为cy,您就会明白为什么动画也从根本上有所不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM