1

https://github.com/ECSlidingViewController/ECSlidingViewControllerに基づいた特別なアニメーションを作成したいと思います。

ズームアニメーションは下の画像のようです。

ここに画像の説明を入力

PI / 4でメインView Controllerを回転させたいだけです。下の画像のように。

ここに画像の説明を入力

以下のコードのように EndState 変換を試みましたが、うまくいきません。

- (void)topViewAnchorRightEndState:(UIView *)topView anchoredFrame:(CGRect)anchoredFrame {

CATransform3D toViewRotationPerspectiveTrans = CATransform3DIdentity;
toViewRotationPerspectiveTrans.m34 = -0.003;
toViewRotationPerspectiveTrans = CATransform3DRotate(toViewRotationPerspectiveTrans, M_PI_4, 0.0f, -1.0f, 0.0f);

topView.layer.transform = toViewRotationPerspectiveTrans;
topView.layer.position = CGPointMake(anchoredFrame.origin.x + ((topView.layer.bounds.size.width * MEZoomAnimationScaleFactor) / 2), topView.layer.position.y);
}

ヘルプ、ポインタ、またはサンプル コード スニペットをいただければ幸いです。

4

2 に答える 2

1

なんとかできました。ECSlidingViewController で指定されたズーム アニメーション コードから、ズーム係数を適用しないでください

- (CGRect)topViewAnchoredRightFrame:(ECSlidingViewController *)slidingViewController{
    CGRect frame = slidingViewController.view.bounds;

    frame.origin.x    = slidingViewController.anchorRightRevealAmount;
    frame.size.width  = frame.size.width/*  * MEZoomAnimationScaleFactor*/;
    frame.size.height = frame.size.height/* * MEZoomAnimationScaleFactor*/;
    frame.origin.y    = (slidingViewController.view.bounds.size.height - frame.size.height) / 2;

    return frame;
}

コメントすることによってMEZoomAnimationScaleFactor

次に、- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContextメソッドの先頭に追加します

[topView.layer setAnchorPoint:CGPointMake(0, 0.5)];
[topView.layer setZPosition:100];

最後に、すべての変換を行うメソッドは次のようにする必要があります。

- (void)topViewAnchorRightEndState:(UIView *)topView anchoredFrame:(CGRect)anchoredFrame {
    CATransform3D transform = CATransform3DIdentity;
    transform.m34 = -0.003;
    transform = CATransform3DScale(transform, ARDXZoomAnimationScaleFactor, ARDXZoomAnimationScaleFactor, 1);
    transform = CATransform3DRotate(transform, -M_PI_4, 0.0, 1.0, 0.0);
    topView.layer.transform = transform;
    topView.frame = anchoredFrame;
    topView.layer.position  = CGPointMake(anchoredFrame.origin.x, anchoredFrame.size.height/2+anchoredFrame.origin.y);
}

アニメーションをお楽しみください :)

于 2014-12-26T12:24:17.167 に答える