Skip to content

CASpringAnimation:stiffness 属性 ​

stiffness 属性是弹簧的劲度。劲度越大,弹簧越硬,动得越快。

值 ​

数,没有单位。

写错时 ​

按 Number() 转换。转换结果不是有限数时抛 TypeError:stiffness must be a finite number, got …。

示例 ​

js
const spring = CASpringAnimation.animationWithKeyPath('position');
spring.stiffness = 120;
console.log(spring.stiffness);

结果:控制台输出 120。

对应的 iOS API ​

CASpringAnimation.stiffness。

参见 ​