
コッコ隊893時計 (2005-9、ミリ秒)
コッコ隊893時計 (2005-9、秒)

(ミリ秒)
(秒)

2005-9に作ったコッコ隊HPの時計FLASHです。
kokko_clock_secは秒単位で893ヘッド君が移動し、kokko_clock_msecはミリ秒単位で893ヘッド君が移動します。
1周1分になるよう作りました。

コッコ隊893時計のプログラムは以下のとおりになっています。
<最初のフレームのフレームアクション>
this.onEnterFrame = function() {
//アナログ時計の時間を取得するプログラム
nowdate = new Date();
hour = nowdate.getHours();
minute = nowdate.getMinutes();
second = nowdate.getSeconds();
millisecond=nowdate.getMilliseconds();
//2の位の0の表示、非表示設定
if (hour<10) {
hour0._visible = true;
} else if (hour>=10) {
hour0._visible = false;
}
if (minute<10) {
minute0._visible = true;
} else if (minute>=10) {
minute0._visible = false;
}
if (second<10) {
second0._visible = true;
} else if (second>=10) {
second0._visible = false;
}
for(mc in this){
this[mc].setnowtime(second,millisecond);
}
};
<コッコ隊893時計ミリ秒の893ヘッド君のムービークリップアクション>
onClipEvent (load) {
//seconds893(周りを動く893)の設定
function setnowtime(s, ms) {
//ミリ秒単位で動く方の設定
if (0<=s && s<=12) {
this._y = 0+5.5;
this._x = s*8.77+114+10.5+ms*8.77/10/100;
} else if (13<=s && s<=16) {
this._x = 114.01+114+10.5;
s14 = s-13;
this._y = s14*7.5+0+5.5+ms*7.5/10/100;
} else if (17<=s && s<=42) {
this._y = 30+5.5;
s18 = s-17;
this._x = -8.77*s18+114.01+114+10.5-ms*8.77/10/100;
} else if (43<=s && s<=46) {
this._x = -114.01+114+10.5;
s44 = s-43;
this._y = -7.5*s44+30+5.5-ms*7.5/10/100;
} else if (47<=s && s<=59) {
this._y = 0+5.5;
s48 = s-47;
this._x = 8.77*s48-114.01+114+10.5+ms*8.77/10/100;
}
}
}
<コッコ隊893時計秒の893ヘッド君のムービークリップアクション>
onClipEvent (load) {
//seconds893(周りを動く893)の設定
function setnowtime(s, ms) {
//秒単位で動く方の設定
if (0<=s && s<=13) {
this._x = 114+10.5;
this._y = 0+5.5;
this._x = s*8.77+114+10.5;
} else if (14<=s && s<=17) {
this._x = 114.01+114+10.5;
this._y = 0+5.5;
s14 = s-13;
this._y = s14*7.5+0+5.5;
} else if (18<=s && s<=43) {
this._x = 114.01+114+10.5;
this._y = 30+5.5;
s18 = s-17;
this._x = -8.77*s18+114.01+114+10.5;
} else if (44<=s && s<=47) {
this._x = -114.01+114+10.5;
this._y = 30+5.5;
s44 = s-43;
this._y = -7.5*s44+30+5.5;
} else if (48<=s && s<=59) {
this._x = -114.01+114+10.5;
this._y = 0+5.5;
s48 = s-47;
this._x = 8.77*s48-114.01+114+10.5;
}
}
}
ちょっとしたポイントですが、取得した時間は0,1,2,3・・・11,12,13,14・・・となっているため、00,01,02・・・と表示するために、いちいち2の位を_visibleでtrueとfalseで表示、非表示を切り替えています。めんどくさいですが、直感的にやったらこうなっちゃいました。

まだまだプログラム付のFLASH作り始めたばっかりで、無駄に定数で計算してます。今度はもっとプロパティとか使ってうまくつくりたい(;´Д`)
公開する意味があるかどうかはわからないけど、こんなヘボいプログラムでも動くもんは動くんですよってなことで紹介させてもらいますた。アクションスクリプト初心者の皆さん、こんなヘボいプログラムつくるひとだっているんです。自身を持ってがんばってくださいな(゚Д゚;)

今回製作したファイル
・kokko_clock_msec.fla
・kokko_clock_msec.fla(「右クリック→対象をファイルに保存(A)...」で保存できます)
・kokko_clock_sec.fla
・kokko_clock_sec.fla(「右クリック→対象をファイルに保存(A)...」で保存できます)
|