}
}
//按钮动作
for (var b = 1; b >= 0; b--) {
var oB = document.createElement('span');
(b) ? oB.innerHTML = '<' : oB.innerHTML = '>';
oB.setIndex = b;
oB.onclick = function(obj){
show({
switch : true,
change : obj.setIndex == 0
});
}.bind(this,oB);
this.elem.btn.appendChild(oB);
}
//数量
for(var n = 0,nL = this.imgs.length; n < nL;n++){
var oI = document.createElement('i');
oI.setIndex = n;
oI.onclick = function(obj){
//显示动画
show({
switch : true,
change : obj.setIndex
});
}.bind(this,oI)
this.elem.num.appendChild(oI);
}
this.elem.numFind = this.elem.num.querySelectorAll('i');
//进度条
this.progre = new Array;
for(var p = 1;p >= 0;p--){
var oP = document.createElement('i');
setCss(oP,{
width : 0,
backgroundColor : p ? '#00c3ff' : '#ffc300'
});
this.elem.progre.appendChild(oP);
this.progre.push(oP);
}
//显示动画
show();
this.elem.numFind[this.index].className = 'on';
}
function setCss(obj,json){
for( c in json){
if(c == 'opacity'){
obj.style.opacity = c;
obj.style.filter = "alpha(opacity="+ (json[c]*100) +")";
}else{
obj.style[c] = json[c];
}
}
return this;
}
function show(order){
order = order || {};
if(new Date() >= this.activeTime){
this.elem.numFind[this.index].className = '';
// 下次播放动画时候的进度条
setCss(this.progre[1],{width : 0})
anime(this.progre[1],{
width : this.size.width
},this.fnTime,function(){
show({
switch : true,
change : true
});
}.bind(this));
var status = true,
activeTime = 0;
for( var i = 0,iL = this.elem.viewBox.length;i < iL;i++ ){
var startTime = getTypeTime(),
endTime = getTypeTime(),
obj = this.elem.viewBox[i];
activeTime = Math.max(activeTime,startTime[1] + endTime[1]);
anime(obj,{
left : Math.ceil(Math.random() * this.size.width * 2 - this.size.width),
top : Math.ceil(Math.random() * this.size.height * 2 - this.size.height),
opacity: 0
}, startTime[0] ,function(obj){
if(order.switch && status){
if(/number/i.test(typeof order.change)){
this.index = order.change;
}else{
(order.change) ? ++this.index : --this.index;
}
setIndex();
this.elem.numFind[this.index].className = 'on';
status = false;
}
setCss(obj,{backgroundImage : 'url("'+this.imgs[this.index]+'")'})










