aboutsummaryrefslogtreecommitdiff
path: root/assets/js/index.js
blob: 5d5ade03ed39df8605ff6ea4bde16a82107e8b81 (plain)
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

		

        var map, wingr,wingl,muscler, musclel, stringr, stringl, cavity, flight_path, flight_path_length, last_point, step;

 //       window.onload = function () {

            step				= 0;
			map                 = Snap('#left-bits');
            wingr           = map.select('#wingr');
            wingrbbox       = wingr.getBBox();
			wingl           = map.select('#wingl');
            winglbbox       = wingl.getBBox();
			musclel           = map.select('#musclel');
            musclelbbox       = musclel.getBBox();
			muscler           = map.select('#muscler');
            musclerbbox       = muscler.getBBox();
			stringl           = map.select('#stringl');
            stringlbbox       = stringl.getBBox();
			stringr           = map.select('#stringr');
            stringrbbox       = stringr.getBBox();
			cavity          = map.select('#cavity');
            cavitybbox       	= cavity.getBBox();
            flight_path     = map.select('#path');

            

			flight_path_length  = Snap.path.getTotalLength(flight_path);

flight_path_length= flight_path_length/100

            last_point          = flight_path.getPointAtLength(flight_path_length);

console.log ('len'+ flight_path_length);


	       
	let cb=function(){step=step+100;

 Snap.animate(step, flight_path_length, function() {
//console.log('pas');  
		moveToPoint = Snap.path.getPointAtLength( flight_path, step );
        x = moveToPoint.x ;
        y = moveToPoint.y ;
//        console.log('animating ' + x + ' ' + y);        
        wingr.transform('translate(' + x + ',' + y + ') '+', '+wingrbbox.cx+', '+wingrbbox.cy);
    },5000, mina.easeout);       


 Snap.animate(step, flight_path_length, function() {
		moveToPoint = Snap.path.getPointAtLength( flight_path, step );
        x = moveToPoint.x ;
        y = moveToPoint.y ;
        wingl.transform('translate(' + x + ',' + y + ')' + (moveToPoint.alpha - 90)+', '+winglbbox.cx+', '+winglbbox.cy);
    },5000, mina.easeout);

Snap.animate(step, flight_path_length, function() {
		moveToPoint = Snap.path.getPointAtLength( flight_path, step );
        x = moveToPoint.x ;
        y = moveToPoint.y ;
        cavity.transform('translate(' + x + ',' + y + ') rotate('+ (moveToPoint.alpha - 90)+', '+cavitybbox.cx+', '+cavitybbox.cy+')');
    },5000, mina.easeout);   

Snap.animate(step, flight_path_length, function() {
		moveToPoint = Snap.path.getPointAtLength( flight_path, step );
        x = moveToPoint.x ;
        y = moveToPoint.y ;
        musclel.transform('translate(' + x + ',' + y + ') rotate('+ (moveToPoint.alpha - 90)+', '+musclelbbox.cx+', '+musclelbbox.cy+')');
    },5000, mina.easeout);       

Snap.animate(step, flight_path_length, function() {
		moveToPoint = Snap.path.getPointAtLength( flight_path, step );
        x = moveToPoint.x ;
        y = moveToPoint.y ;
        muscler.transform('translate(' + x + ',' + y + ') rotate('+ (moveToPoint.alpha - 90)+', '+musclerbbox.cx+', '+musclerbbox.cy+')');
    },5000, mina.easeout); 

Snap.animate(step, flight_path_length, function() {
		moveToPoint = Snap.path.getPointAtLength( flight_path, step );
        x = moveToPoint.x ;
        y = moveToPoint.y ;
        stringr.transform('translate(' + x + ',' + y + ') rotate('+ (moveToPoint.alpha - 90)+', '+stringrbbox.cx+', '+stringrbbox.cy+')');
    },5000, mina.easeout); 

Snap.animate(step, flight_path_length, function() {
		moveToPoint = Snap.path.getPointAtLength( flight_path, step );
        x = moveToPoint.x ;
        y = moveToPoint.y ;
        stringl.transform('translate(' + x + ',' + y + ') rotate('+ (moveToPoint.alpha - 90)+', '+stringlbbox.cx+', '+stringlbbox.cy+')');
    },5000, mina.easeout); 
          
}

document.addEventListener("requestMove", cb,false);