【问题标题】:ios CATransform3DMakeScale scaleup animationios CATransform3DMakeScale 放大动画
【发布时间】:2012-08-27 06:28:27
【问题描述】:

我有以下动画:

CATransform3D scaleTransform = CATransform3DMakeScale(0.1,0.1, 1.0);
scaleAnimation.toValue = [NSValue valueWithCATransform3D:scaleTransform];
keyframeAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];;

我正在缩小子视图。但我试图做相反的事情。从子视图大小的 0.01% 开始,到子视图大小的 100%。有谁知道我该怎么做?

【问题讨论】:

    标签: ios xcode animation subview scaletransform


    【解决方案1】:

    这样做:

    yourSubView.transform = CGAffineTransformMakeScale(0.01, 0.01);
    [UIView animateWithDuration:0.4 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 
    //change time duration according to requirement
    // animate it to the identity transform (100% scale)
    yourSubView.transform = CGAffineTransformIdentity;
    } completion:^(BOOL finished){
    // if you want to do something once the animation finishes, put it here
    }];
    

    【讨论】:

    • 如何使用上述代码为动画添加一些运动,如 CGPathMoveToPoint?
    猜你喜欢
    • 1970-01-01
    • 2011-07-07
    • 1970-01-01
    • 2013-12-12
    • 1970-01-01
    • 2018-05-26
    • 2012-10-13
    • 1970-01-01
    • 2020-07-26
    相关资源
    最近更新 更多