티바이트




작동방법

- 마우스를 휘저어 보세요

- 화면을 클릭하고 마우스를 휘저어 보세요

- 오른쪽 아래 구석에 있는 podo로고를 클릭해 보세요

  한 번 누를 때 마다 노란 불빛이 켜졌다가 꺼졌다가를 반복하며

  불이 켜져 있을 때는 화면에 잔상이 남아서 색다른 모양을 볼 수 있습니다.

  

(1차 수정 : podo로고가 두번씩 눌려서 켜졌다가 다시 꺼지는 버그 수정)



(▼ 이곳에 플래시가 삽입되어 있습니다. 일부 환경에서는 보이지 않을 수 있습니다.) 




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.geom.Point;
import flash.utils.ByteArray;
import flash.events.MouseEvent;
import flash.geom.ColorTransform;
import flash.filters.GlowFilter;
 
 
const MAX_UNIT:int = 4096;
 
 
var bmpDatF:BitmapData = new BitmapData(1,1,false,0x0000ff);
var bmpDatB:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight,false,0x000000);
var canvas:Bitmap = new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight,false,0xffffff));
var velVec:Vector.<Point> = new Vector.<Point>(MAX_UNIT);
var posVec:Vector.<Point> = new Vector.<Point>(MAX_UNIT);
var colorVec:Vector.<uint> = new Vector.<uint>(MAX_UNIT);
var blueTransform:ColorTransform = new ColorTransform(0.86,0.86,0.86);
 
 
var datumPoint:Point = new Point(0,0);
var theta:Number = 0;
 
velVec.fixed = true;
posVec.fixed = true;
colorVec.fixed = true;
 
for(var i:int=0; i<MAX_UNIT; i++) {
    velVec[i] = new Point(0,0);
    posVec[i] = new Point(0,0);
    colorVec[i] = getColorByHue(i/MAX_UNIT*i/MAX_UNIT*i/MAX_UNIT*i/MAX_UNIT*360);
}
addChild(canvas);
 
 
 
 
var timer:Timer = new Timer(1000/60);
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.start();
 
function timerHandler(evt:TimerEvent):void
{
    canvas.bitmapData.lock();
     
    if(podoed)
        canvas.bitmapData.colorTransform(canvas.bitmapData.rect, blueTransform);
    else
        canvas.bitmapData.copyPixels(bmpDatB,bmpDatB.rect,datumPoint);
         
    var dx:Number;
    var dy:Number;
    var direction:Number;
    var color:uint;
    for(var i:int=MAX_UNIT-1; i>=0; i--) {
        dx = stage.mouseX-posVec[i].x;
        dy = stage.mouseY-posVec[i].y;
        direction = Math.atan2(dy,dx);
         
        velVec[i].x += (i/MAX_UNIT*3.6+0.5)*Math.cos(direction);
        velVec[i].y += (i/MAX_UNIT*3.6+0.5)*Math.sin(direction);
         
        posVec[i].x += velVec[i].x;
        posVec[i].y += velVec[i].y;
         
        velVec[i].x *= i/MAX_UNIT*0.14+0.85;
        velVec[i].y *= i/MAX_UNIT*0.14+0.85;
         
        if(Math.abs(dx)<1&&Math.abs(dy)<1) {
            posVec[i].x = stage.mouseX;
            posVec[i].y = stage.mouseY;
            velVec[i].x = 0;
            velVec[i].y = 0;
        }
        canvas.bitmapData.setPixel(posVec[i].x,posVec[i].y,colorVec[i]);
    }
    canvas.bitmapData.unlock();
}
 
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler);
function clickHandler(evt:MouseEvent):void
{
    if(evt.stageX>podo.x && evt.stageX<podo.x+podo.width
       && evt.stageY>podo.y && evt.stageY<podo.y+podo.height) {
        podoClicked(null);
        return;
    }
    for(var i:int=0; i<MAX_UNIT; i++) {
        velVec[i].x = 0;
        velVec[i].y = 0;
        posVec[i].x = evt.stageX;
        posVec[i].y = evt.stageY;
        //velVec[i].y = Math.random()*-20;
         
    }
}
 
function getColorByHue(angle:Number):uint
{
var hue:Number = (angle+0) % 360;
    var variation:uint = uint((hue % 60)/60*0xff);
    var red:uint, blue:uint, green:uint;
    if (hue<60) {
        red = 0xff;
        blue = 0;
        green = variation;
    }
    else if (hue < 120) {
        red = 0xff - variation
        blue = 0;
        green = 0xff;
    }
    else if (hue < 180) {
        red = 0
        blue = variation;
        green = 0xff;
    }
    else if (hue < 240) {
        red = 0x0;
        blue = 0xff;
        green = 0xff-variation;
    }
    else if (hue < 300) {
        red = variation;
        blue = 0xff;
        green = 0x0;
    }
    else if (hue < 360) {
        red = 0xff;
        blue = 0xff-variation;
        green = 0;
    }
     
    return red<<16|green<<8|blue;
}
 
 
var podo:Sprite = new Podo();
podo.width*=0.40;
podo.height*=0.40;
podo.x = stage.stageWidth-podo.width;
podo.y = stage.stageHeight-podo.height;
stage.addChild(podo);
 
var podoed:Boolean = false;
var podoFilter:GlowFilter = new GlowFilter(0xffff00,1,4,4,4,3);
function podoClicked(evt:MouseEvent):void
{
    if(!podoed) {
        podo.filters = [podoFilter];
        podoed = true;
    }else{
        podo.filters = [];
        podoed = false;
    }
}
===========================================================================






 


댓글을 다는 공간입니다. (로그인하지 않아도 댓글을 남길 수 있습니다.)



게시판 목록은 좌측상단에 있습니다.

05-29 00:10