gpt4 book ai didi

ios - 有没有办法利用自定义动画的 CoreAnimation 完成曲线数学?

转载 作者:行者123 更新时间:2023-11-29 12:48:56 26 4
gpt4 key购买 nike

出于各种原因,我使用 CADisplayLink 手动制作动画:

- (void)update:(CADisplayLink *)sender;
{
// Linearly interpolate proportion animated based on elapsed time
CGFloat proportion = ...

[self updateAnimationForProportion:proportion];
}

我想要一个 UIViewAnimationOptionCurveEaseInOut 而不是线性计算。

  • 是否可以从 CoreAnimation 获得回调而不是手动实现数学?
  • 或者更好的是,是否可以使用基于 iOS7 物理的动画?

    [UIView animateWithDuration:0.5 delay:0.0
    usingSpringWithDamping:0.5
    initialSpringVelocity:0.5
    options:0 animations:^{ ... } completion:nil];

最佳答案

看来不可能。

如果它能帮助任何希望在 iOS 中使用缓动曲线的人,我从 jquery.easing.1.3 中获取了这个方便的缓动曲线列表,并将它们移植为可在 C 中作为一个简单的头文件(、C++、Objective-C、等):

https://gist.github.com/MeteC/10012959

关于ios - 有没有办法利用自定义动画的 CoreAnimation 完成曲线数学?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22897204/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com