0

私はiOSのグラフィックスとアニメーションが初めてで、下のビデオに見られるように、フリック時に画像の運動量回転の効果を達成する方法を知りたい.

http://www.youtube.com/watch?v=ZIQs-OWgkgI(今は壊れています)

フリックしなくても映像が揺れていい感じです。

ありがとう。

4

3 に答える 3

1

それはかなり滑らかです。ビューをポイント(上部の中心)を中心に回転させてから、アルゴリズムで回転にかかる時間を変更し、必要に応じて逆にします。コードを提供することはできませんが、Hegarty 教授によるこのビデオ デモを見ると、必要なツールを入手できると思います。彼はビューの外側の点を中心に回転します - ビューの端を中心に回転できます (ビューを縮小しないでください)。見てみな:

パート 1: http://www.stanford.edu/class/cs193p/cgi-bin/drupal/node/291

パート 2: http://www.stanford.edu/class/cs193p/cgi-bin/drupal/node/293

説明がたくさんあるので、iTunes U (無料) からビデオをダウンロードすることをお勧めします。

幸運を、

ダミアン

于 2012-02-27T16:22:43.047 に答える
0
//this code can be used to rotate an image having both back and front 

   rotate = [UIButton buttonWithType:UIButtonTypeCustom];
        [rotate addTarget:self action:@selector(rotate1)forControlEvents:UIControlEventTouchDown];
        rotate.frame = CGRectMake(137.5, 245, 45, 46);
        [rotate setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"viewing.png"]] forState:UIControlStateNormal];
        [self.view addSubview:rotate];

     int count;
     count=0;

    -(void)rotate1
    {


        count=count+1;
        NSLog(@"rotate");
        [UIView transitionWithView:imagecircle    // use the forView: argument
                          duration:1          // use the setAnimationDuration: argument
                           options:UIViewAnimationOptionTransitionFlipFromLeft
         // check UIViewAnimationOptions for what options you can use
                        animations:^{         // put the animation block here
                            imagecircle.image = imagecircle.image;
                        }
                        completion:NULL];

        if(count%2==0)
        {
            NSLog(@"image.str.%@",appDelegate.imageNameString);
            [imagecircle setImage:[UIImage imageNamed:appDelegate.imageNameString]];
            [labellocation removeFromSuperview];
            [labeldate removeFromSuperview];
            [self.imagecircle addSubview:labelfrom];

        }
        else
        {
             [imagecircle setImage:[UIImage imageNamed:@"TGP_BACK.png"]];
             [labelfrom removeFromSuperview];
             [self.imagecircle addSubview:labellocation];
             [self.imagecircle addSubview:labeldate];
        }



    }
于 2013-05-10T10:57:35.163 に答える
0

これの作者に確認したところ、Box2D 物理ライブラリを使用して実装されているとのことでした。私はそれを試してみるつもりです。回答ありがとうございます。

于 2012-02-28T18:50:53.940 に答える