我如何让我的CAKeyframeAnimation
无限重复播放?
我尝试使用 animation.repeatCount = -1;
,但它只会重复一次。
我如何让我的CAKeyframeAnimation
无限重复播放?
我尝试使用 animation.repeatCount = -1;
,但它只会重复一次。
你也可以使用
animation.repeatCount = INFINITY;
这与HUGE_VALF完全相同,但我更喜欢使用INFINITY,因为它本身就很清楚明了。
尝试使用 animation.repeatCount = HUGE_VALF;
在Swift中,我正在使用以下代码:
let animation = CATransition()
animation.repeatCount = Float.infinity
只需转到定义!
无论是HUGE_VALF还是INFINITY,都不要紧。
因为:
(math.h:)
#if defined(__GNUC__)
# define HUGE_VAL __builtin_huge_val()
# define HUGE_VALF __builtin_huge_valf()
# define HUGE_VALL __builtin_huge_vall()
# define NAN __builtin_nanf("0x7fc00000")
#else
# define HUGE_VAL 1e500
# define HUGE_VALF 1e50f
# define HUGE_VALL 1e5000L
# define NAN __nan()
#endif
#define INFINITY HUGE_VALF
/* FUNCTION: __builtin_huge_valf */
inline float __builtin_huge_valf(void) { return 1.0f/0.0f; }
animation.repeatCount = INFINITY;
animation.repeatCount = HUGE_VALF;
animation.repeatCount = __builtin_huge_valf();
animation.repeatCount = 1.0f/0.0f;