RSS | Twitter | Facebook
Home » ActionScript » math » trigonometric » 三角関数 サイクロイド : ActionScript

三角関数 サイクロイド : ActionScript

サイクロイドのサンプルを作成しました。

// 点オブジェクト
function PointClip(radius, speed, originX, originY) {
	// 角度
	var degree = 0;
	// 半径
	var radius = radius;
	// 移動スピード
	var speed = speed
	// 初期座標
	this._x = originX;
	this._y = originY;

	// サイクロイド処理
	this.onEnterFrame = function() {
		var theta = Math.PI/180*degree;
		this._x = originX + radius*(theta-Math.sin(theta));
		this._y = originY + radius*(1-Math.cos(theta));
		if (degree>720) {
			trace(this._x);
			this.removeMovieClip();
		} else {
			degree += speed;
		}
	};
}
// 原点
var originX = 0;
var originY = 75;
// 経
var radius = 20;
// Y軸の長さ
lineStyle(1, 0x00, 100);
moveTo(0, 75);
lineTo(axisX, 75);
// 半径, 移動スピード, X, Y
var o = new PointClip(40, 10, 0, 0);
attachMovie('clip', 'ball', 0, o);

このページの上へ移動

  Yahoo!ブックマークに登録    Google  この記事をクリップ!  BuzzurlにブックマークBuzzurlにブックマーク

2008/3/3 月 | trigonometric | 固定リンク |

コメントはまだありません。

コメントの投稿

改行と段落タグは自動で挿入されます。メールアドレスは表示されません。
利用可能な HTML タグ :
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite="">
<cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(必須)

(必須)


トラックバックURL

このページの上へ移動