2009-01-12
ActionScriptの練習2
今度はお星様。
・レイヤ側
// お星様
for (i=1;i<50;i++) {
this.star0.duplicateMovieClip('star'+i, i);
}
・星オブジェクト側(star0)
onClipEvent(load) {
// 配置座標
this._x = Math.random() * Stage.width;
this._y = Math.random() * Stage.height;
// 透明度
this._alpha = 50 + Math.random() * 20;
// 倍率
this._xscale = this._yscale = 50 + Math.random() * 50;
// 中心からの距離
distance_from_center = Math.sqrt(
(200 - this._x) * (200 - this._x) + (200 - this._y) * (200 - this._y)
);
// 現在の角度
rad = Math.random() * 360;
}
onClipEvent(enterFrame) {
// 中心からの距離がdistance_from_centerで一度ずつズレてく
rad += 1;
this._x = Math.cos((rad/180) * Math.PI) * distance_from_center + 200;
this._y = Math.sin((rad/180) * Math.PI) * distance_from_center + 200;
}
三角関数だよ!全員集合!><
次は砂時計作りたいなぁ。
コメントを書く
トラックバック - http://d.hatena.ne.jp/rin1024/20090112/1231758678
リンク元
- 7 http://www.google.co.jp/search?sourceid=navclient&hl=ja&ie=UTF-8&rlz=1T4GGIH_jaJP281JP282&q=SQL+Server2000+エラー SQL+Serverの信頼関係に関連付けら?
- 6 http://www.google.co.jp/search?hl=ja&q=このユーザーは+SQL+Server+の信頼関係接続と関連付けられて??
- 5 http://www.google.co.jp/search?hl=ja&client=firefox-a&rls=org.mozilla:ja:official&hs=OVv&q=firefox3 落ちる&btnG=検索&lr=lang_ja
- 4 http://lab-works.no-ip.org/snow/
- 3 http://www.google.com/search?q=スクロールバー+クリック イベント&rls=com.microsoft:*:IE-SearchBox&ie=UTF-8&oe=UTF-8&sourceid=ie7&rlz=1I7DBJP_ja
- 2 http://209.85.175.132/search?q=cache:-nVcsaRlrWkJ:d.hatena.ne.jp/rin1024/20080620/1213910268+firefox3+youtube+落ちる&hl=ja&ct=clnk&cd=4&gl=jp&lr=lang_ja&client=firefox-a
- 2 http://ezsch.ezweb.ne.jp/search/?sr=0101&query=ダイクストラ
- 2 http://mail.google.com/mail/?ui=2&view=bsp&ver=1qygpcgurkovy
- 2 http://www.google.co.jp/reader/view/?hl=ja&tab=wy
- 2 http://www.google.co.jp/search?hl=ja&q=フロイド法&lr=lang_ja
