不気味な火の玉時計を作ってみたら、呪いのようなバグに悩まされた

このエントリをはてなブックマークに追加このエントリをはてなブックマークに追加このエントリをdel.icio.usに追加このエントリをLivedoor Clipに追加このエントリをLivedoor Clipに追加このエントリをYahoo!ブックマークに追加このエントリをFC2ブックマークに追加このエントリをNifty Clipに追加このエントリをPOOKMARK. Airlinesに追加このエントリをBuzzurl(バザール)に追加このエントリをBuzzurl(バザール)に追加このエントリをChoixに追加このエントリをnewsingに追加このエントリをkwoutに追加
2008年10月9日 木曜日22:51:40

今回もソース

ソースはそんなに長くないので、全掲載。

/*
 *  Copyright 2008 tarotarorg(http://tarotaro.org)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.tarotaro.flash.display
{
    import com.trick7.effects.TeraFire;
    import com.trick7.utils.TeraClock;
    import flash.display.Sprite;
    import flash.display.StageScaleMode;
    import flash.events.Event;
   
    /**
     * ...
     * @author 太郎(tarotaro.org)
     */

    [SWF(width="120", height="600", backgroundColor="0xFFFFFF", frameRate="30")]
    public class BurningClock extends Sprite
    {
        private var _clock:TeraClock;
        private var _fire:TeraFire;
        private var _fx:Number;
        private var _fy:Number;
        private var _fw:Number;
        private var _fh:Number;

        public function BurningClock()
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }

        private function init(e:Event = null):void
        {
            this.stage.scaleMode = StageScaleMode.NO_SCALE;
            this._fx = this.stage.stageWidth / 2;
            this._fy = this.stage.stageHeight * 0.95;
            this._fw = this.stage.stageWidth / 24;
            this._fh = this.stage.stageHeight / 45;
            this._clock = new TeraClock(9);
            this._clock.addEventListener(TeraClock.SECONDS_CHANGED, secondChanged);

            this._fire = new TeraFire(this._fx,
                                      this._fy,
                                      (this._clock.hours + 1) * this._fw + 1,
                                      (this._clock.minutes + 1) * this._fh + 5,
                                      ((0xFF-this._clock.hours) <<16) | (this._clock.minutes <<8) | this._clock.seconds * 4,
                                      (this._clock.seconds <<16) | (this._clock.minutes <<8) | this._clock.hours);
            this.addChild(this._fire);
        }
       
        private function secondChanged(e:Event):void
        {
            this._fire.changeFire(
                                      (this._clock.hours + 1) * this._fw + 1,
                                      (this._clock.minutes + 1) * this._fh - 5,
                                      ((0xFF-this._clock.hours) <<16) | (this._clock.minutes <<8) | this._clock.seconds * 4,
                                      (this._clock.seconds <<16) | (this._clock.minutes <<8) | this._clock.hours);
        }
    }
}

似たネタ

trick7.com blog: 東京てら子 5 の連絡と、dotfes&WebDesigningでのお願い
経由で、TeraFireとTeraClockを使ってる類似ネタを発見。

TeraFireライブラリとTeraClockライブラリを使って、アナログ時計を作ってみました。
flabaka - TeraFireとTeraClockでアナログ時計

なるほど、こっちの方が実用性が高い。
でも気にしない。俺の方が先にネタを出してる。しかも色が違うし。
実用性なんてどうでもいいんだー!

  • ページ:
  • 1
  • 2

コメント (2) »

  1. はじめまして。
    flabakaというブログを書いております、あつのすけと申します。

    この度は(ブログを)ご紹介して頂きまして、ありがとうございます!

    実用性を考えて作ったのではなく、「もう一つくらいアナログ時計作ろうかなぁ…」「そういえば、TeraFireをきちんと使ったことまだないなぁ…」「じゃあ、TeraFireでアナログ時計作ってみようかなぁ…」なんていう、軽い気持ちで作ったものです。

    トラックバックにて、「TeraFireとTeraClockを一緒に使われた方が(僕以外にも)いらっしゃったんだぁ…」と嬉しくなりました!

    今後とも、宜しく御願い致します。

    コメント by あつのすけ — 2008年10月10日 金曜日 @ 19:19:46

  2. >あつのすけ さん
    コメントありがとうございます。
    TeraFireとTeraClockは同じ人が作ったのにセットで使う人が少ないのはもったいないですよね。
    TeraFireはあんなに不気味でかわいいのに。

    そうそう、TeraFireにbranches作って、色を変えられるバージョンを作ったので是非使ってみて下さい。

    コメント by 太郎 — 2008年10月15日 水曜日 @ 1:54:43

TrackBack URL :

コメントする

HTML convert time: 1.114 sec.