moveCircular

始めにAnimation Engineを開いて、start using stack "animationEngine" サンプルスタックは、下記をメッセージボックスにコピペしてリターンキーを go stack \ url "http://kenjikojima.com/livecode/ae/moveCircular.livecode" 正円の軌跡で移動するオブジェクトのカスタム・キー「moveCircular」を作って、必要なプロパティを設定します。 これは正円上の軌跡で移動と言う事で、必ずしもグラフィックの円を描かなくても、 円のセンターと半径を設定すれば動くようです。 -- グラフィック「movingBlue」を作ったら、メッセージボックスから send moveCircular to grc "movingBlue" を送ると、カスタムキー「moveCircular」が grc "movingBlue" に作られて、 プロパティのデフォルト値が以下のように書き込まれます。カッコ内はデフォルトの値 centerX  軌跡になる円のセンターX (grc "movingBlue"のあった X) centerY  軌跡になる円のセンターY (grc "movingBlue"のあった Y) isAngle  軌跡になる円の arcAngle (1) isRadius  軌跡になる円の半径 (50) step  移動するオブジェクトのスピード (1) 移動する軌跡がわかりやすいように、上の値を元に円を作ります。 width, height ともに 100 ピクセルの円(半径 50)、ロケーションは grc "movingBlue"のあったX,Y で 円を作ると(サンプルは 200,160)、 grc "movingBlue"は 1 の位置に移動します。 これで grc "movingBlue" に、moveCircular を送るとこの円上の軌跡で移動します。 -- ボタン「startStop」を作って、円上で移動するスクリプトを書き込みます。 -- movePoligonal のスタートストップとまったく同じです。 on mouseUp if the flag of me is empty then set the flag of me to false set the flag of me to not the flag of me if the flag of me then hereWeGo end mouseUp on hereWeGo send moveCircular to grc "movingBlue" if the flag of me then send hereWeGo to me in 20 milliseconds end hereWeGo これでボタンをクリックすると、step 1 のスピードで時計回りにオブジェクトが移動します。 -- スピードを上げるには “step” の数を増やします set the moveCircular["step"] of grc "movingBlue" to 3 -- 反対回り(左回り)にするには、“step” の数をマイナスにします set the moveCircular["step"] of grc "movingBlue" to -4