Apple Developer Connection
Advanced Search
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page >

例:Dancing Cubeコンポジション

Dancing Cubes.qtzコンポジション(/Developer/Examples/Quartz Composer/Motion Graphics Compositions/ディレクトリにあります)は、マウスを追跡し、マウスの位置に基づいて一連のキューブをレンダリングします。

Dancing Cubeコンポジションが再生されるようにnibファイルに変更を加えるには、以下の手順に従います。

  1. Cocoaアプリケーションを作成し、Quartzフレームワークを追加します。

    詳細については、“Cocoaアプリケーションを作成する”を参照してください。

  2. XcodeのプロジェクトウインドウでMainMenu.nibファイルをダブルクリックします。

    メインのアプリケーションウインドウが開いた状態でInterface Builderが起動します。

  3. ウインドウを選択した状態で、「Tools」>「Show Inspector」を選び、「Inspector」ウインドウを開きます。

  4. 「Inspector」ウインドウの「Size」ペインで、ウインドウの幅を640に設定し、ウインドウの高さを480に設定します。

  5. パレットからメインウインドウにQCViewをドラッグします。その後、ウインドウいっぱいにQCViewのサイズを広げます。

  6. QCViewを選択した状態で、「Tools」>「Show Inspector」を選び、「Inspector」ウインドウを開きます。

  7. 「Inspector」ウインドウの「Size」ペインで「Autosizing」の内側の線のセットをクリックし、バネのように表示されるようにします。これはFigure 3-4のようになります。


    Figure 3-4  内側のバネは自動サイズ変更が設定されたことを指定する

    The inner springs specify that autosizing is set
  8. 「Inspector」ウインドウの「Attributes」ペインで、「Load」をクリックし、/Developer/Examples/Quartz Composer/Motion Graphics Compositions/ディレクトリからDancing Cubes.qtzを選びます。

  9. 「Forward All Events」をクリックし、コンポジションがすべてのマウスイベントを受け取れるようにします。

  10. 「File」>「Test Interface」を選びます。Figure 3-5に示すような外観のキューブがウインドウに表示されます。


    Figure 3-5  Dancing Cubeコンポジション

    The Dancing Cubes composition
  11. マウスポインタをウインドウに移動します。そこで、マウスボタンをクリックしたままマウスを動かします。

    マウスボタンを押している間、マウスの動きに合わせてキューブの動きが追従します。

  12. インターフェイステストを終了し、nibファイルを保存します。

  13. Xcodeに切り替え、アプリケーションをビルドします。



< Previous PageNext Page >


Last updated: 2006-12-05




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice