3D Zoom Menu

Posted On: July 28, 2009
Price: Free!
Flash Player Version: 8
Swishmax Version: Swishmax2, 2008.08.12
Comments: 6 comments

Click on items to view them zooming in a 3D field.

Download
91 downloads
 

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
onFrame (1) {
    var numItems = 10;
    var focalLength = 100;    
    var centerX = Stage.width/2;    
    var centerY = Stage.height/2;
    this.initCamera = function(){
        this.oCamera = new Object();
        this.oCamera.x = 0;        
        this.oCamera.y = 0;        
        this.oCamera.z = focalLength/2;        
        this.oCamera.dx = 0;        
        this.oCamera.dy = 0;        
        this.oCamera.dz =-focalLength/2;        
        this.oCamera.s = 90;        
        this.oCamera.t = 0;
        this.onEnterFrame = function(){
            with(this.oCamera){                
                t = (t>=50) ? null : t+1;                
                x = (t>=50) ? x : easeIn(t,x,(dx-x),50);                
                y = (t>=50) ? y : easeIn(t,y,(dy-y),50);                
                z = (t>=50) ? z : easeIn(t,z,(dz-z),50);                
            }            
        }
        this.btn.onRelease = function(){            
            this._parent.oCamera.dx = 0;            
            this._parent.oCamera.dy = 0;            
            this._parent.oCamera.dz = -focalLength/2;            
            this._parent.oCamera.t = 0;            
        }
        for(var i = 0; i<=numItems;i++){
            this.attachMovie("instance", "instance_mc_"+i,i);            
            clip = this["instance_mc_"+i];
            clip.x = random(Stage.width)- centerX ;  
            clip.y = random(Stage.height)- centerY;
            clip.z = random(focalLength*2)-focalLength;
            clip.ID.text = i;            
            clip.onPress = function(){
                this.swapDepths(numItems+1);
                this._parent.oCamera.t = 0;
                this._parent.oCamera.dx = this.x;                
                this._parent.oCamera.dy = this.y;                
                this._parent.oCamera.dz = this.z+this._parent.focalLength*.9;                
            }
            clip.onEnterFrame = function(){
                var zpos = (this.z-this._parent.oCamera.z);
                var scale = this._parent.focalLength/(this._parent.focalLength + zpos);
                this._visible = (scale <= 10);
                this._x = (this.x - this._parent.oCamera.x )*scale + centerX;                
                this._y = (this.y - this._parent.oCamera.y )*scale + centerY;
                this._xscale = scale*100;
                this._yscale = scale*100;
                this._alpha = scale*100;
            }            
        }        
    }
    this.rand = function(nb1,nb2){        
        return Math.floor(Math.random() * ((nb2 - nb1)+ 1)) + nb1;        
    }
    this.easeIn = function (t, b, c, d,a,p) {        
        if (t==0) return b;        
        if (t==d) return b+c;        
        if ((t/=d/2) <= 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;        
        return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;        
    };
    initCamera();    
    stop();
}
VN:F [1.7.0_948]
Rating: 9.0/10 (4 votes cast)