JSDM

HTML

 
1
<center>
2
<div id = 'loader'></div> 
3
</center>
4

CSS

xxxxxxxxxx
11
 
1
#loader{
2
 
3
  width: 30px;
4
  height: 30px;
5
  margin-top: 150px;
6
}
7
body{
8
  height: 100%;
9
  width: 100%;
10
  background: #000;
11
}
? ?
? ?
必须是有效的URL
+ 添加另一个资源

JS

xxxxxxxxxx
162
 
1
var speed = 0.3
2
var amount = 3
3
var bg_color = "#000"
4
var bg_color2 = "#000"
5
var size = 30
6
7
var color1 = "rgba(255,255,0,1)";
8
var color2 = "rgba(0,255,255,1);";
9
10
11
function loader(){
12
  this.loader_div = $("#loader");
13
14
  this.bars = [];
15
   var root = this;
16
  
17
    
18
  
19
  
20
     
21
  //INIT
22
  this.stage = new Kinetic.Stage({
23
    container: "loader",
24
    width: this.loader_div.width(),
25
    height: this.loader_div.height(),
26
  });
27
28
  
29
  this.front_cover = new Kinetic.Layer();
30
  this.back_cover = new Kinetic.Layer();
31
  this.inner = new Kinetic.Layer();
32
  
33
     
34
  
35
  for(var i=1;i<amount+1;i++){
36
    var bar = new Kinetic.Wedge({
37
      x: this.stage.getWidth()/2,
38
      y: this.stage.getHeight()/2,
39
      radius: 0,
40
      angle: 15,
41
      rotation: (360/amount)*i,
42
      fill: color1,
43
      shadowColor: "rgba(0,255,255,0.2)",
44
    });
45
    this.bars.push(bar);
46
    this.inner.add(bar);
47
  }
48
  
49
  
50
  
51
  
52
  this.back_circle = new Kinetic.Circle({
53
    x: this.stage.getWidth()/2,
54
    y: this.stage.getHeight()/2,
55
    radius: 0,
56
    fill: bg_color2,
57
    
58
  })
59
  
60
  this.front_circle = new Kinetic.Circle({
61
    x: this.stage.getWidth()/2,
62
    y: this.stage.getHeight()/2,
63
    radius: 0,
64
    fill: bg_color,
65
    shadowColor: "rgba(0,0,0,0.5)",
66
    shadowSize: 10,
67
  })
68
69
  
70
  this.front_cover.add(this.front_circle);
71
  this.back_cover.add(this.back_circle);
72
  this.stage.add(this.back_cover,this.inner,this.front_cover);
73
74
75
  
76
  
77
78
79
    this.play = function(){
80
    TweenLite.to(this.back_circle,speed/3,{
81
      kinetic:{
82
        radius: size/2,
83
      },
84
    })
85
    
86
    TweenLite.to(this.bars,speed/3,{
87
      kinetic:{
88
        radius: size/2,
89
      },
90
      ease: Power2.easeOut,
91
    })
92
    TweenLite.to(this.front_circle,speed/3,{
93
      delay: 0.1,
94
      kinetic:{
95
        radius: size/2.3,
96
      },
97
      ease: "Power2.easeOut",
98
      onComplete: function(){
99
        root.load_rotate(0,1,0);
100
      }
101
    })
102
  }
103
    
104
105
106
107
108
109
110
111
  var s = speed*1.2;
112
  this.load_rotate = function(count,r1,r2){
113
    var r1 = r1;
114
    var r2 = r2;
115
    var count = count;
116
  
117
    if(count>=1){
118
119
      r1 = r1*= -1;
120
      r2 = 1-r2;
121
      
122
      count = 0;
123
      
124
    }
125
    if(r1<0){
126
      e =  Power1.easeOut;
127
      f = color1;
128
    }else{
129
      e = Power2.easeOut;
130
      f = color2;
131
    }
132
    TweenMax.staggerTo(this.bars,s,{
133
      kinetic:{
134
        angle: "+="+((360/amount-40)*r1),
135
        rotation: "+="+((360/amount+30)*r2),
136
        fill: f,
137
      },
138
      ease: e,
139
140
      
141
    },s/3);
142
143
    TweenLite.to(this.loader_div,2,{
144
      rotationZ: "+="+180,
145
      ease: Power2.easeOut
146
    });
147
148
    setTimeout(function() {
149
150
      root.load_rotate(count+1,r1,r2);
151
    }, s*1600);
152
  }
153
}
154
155
156
$(window).load(function(){
157
  
158
   
159
  var l = new loader();
160
  l.play();
161
});
162
必须是有效的URL
请输入有效的URL
请输入有效的URL
请输入有效的URL
+ 添加另一个资源
Close

文件管理 点击文件查看URL

图片

  1. 暂无文件

CSS

  1. 暂无文件

JavaScript

  1. 暂无文件

其他

  1. 暂无文件
拖动文件到上面的区域或者:
加载中 ..................