博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2016/02/04
阅读量:4949 次
发布时间:2019-06-11

本文共 4450 字,大约阅读时间需要 14 分钟。

;(function(window){

'use strict';
function extend(a,b){
for(var key in b){
if(b.hasOwnProperty(key)){
a[key] = b[key];
}
}
return a;
}
function SVGLoder(el,options){
this.el = el;
this.options = extend({},this.options);
extend(this.options,options);
this._init();
}
SVGLoader.prototype.options = {
speedIn : 500,
easingIn : mina.linear
}
SVGLoader.prototype._init = function(){
var s = Snap(this.el.querySelector('svg'));
this.path = s.select('path');
this.initialPath = this.path.attr('d');
var openingStepStir = this.el.getAttribute('data-opening');
this.openingSteps = openingStepStir?openingStepStir.split(':'):'';
this.openingStepsTotal = openingStepStir?this.openingSteps.length:0;
if(this.openingStepsTotal == 0)return;
var closingStepsStir = this.el.getAttribute('data-closing')?this.el.getAttribute('data-closing'):this.initialPath;
this.closingSteps = closingStepsStir?closingStepsStir.split(':'):'';
this.closingStepsTotal = closingStepsStir?this.closingSteps.length:0;
this.isAnimating = false;
if(!this.options.speedOut){
this.options.speedOut = this.options.speedIn;
}
if(this.options.easingOut){
this.options.easingIn = this.options.easingOut;
}
}
SVGLoder.prototype.show = function(){
if(this.isAnimating)return false;
this.isAnimating = true;
var self = this,
onEndAnimation = function(){
classie.addClass(self.el,'pageload_loading');
};
this._animateSVG ('in',onEndAnimation);
classie(this.el,'show');
}
SVGLoder.prototype.hide = function(){
var self = this;
classie.removeClass(this.el,'pageload_loading');
this._animateSVG ('out',function(){
self.path.attr('d',self.initialPath);
classie.removeClass(self.el,'show');
self.isAnimating = false;
});
}
SVGLoder.prototype._animateSVG = function(dir,callback){
var self = this,
pos = 0,
steps = dir = 'out'?this.closingSteps:this.openingSteps,
stepsTotal = dir = 'out'?this.closingStepsTotal:this.openingStepsTotal,
speed = dir = 'out'?self.options.speedIn:self.options.speedOut,
easing = dir = 'out'?self.options.easingIn:self.options.easingOut,
nextStep = function(pos){
if(pos>stepsTotal - 1){
if(callback && typeof callback == 'function'){
callback();
}
return;
}
self.path.animate({'path':steps[pos]},speed,easing,function(){nextStep(pos)});
pos++;
};
nextStep(pos);
}
window.SVGLoader = SVGLoder;
})(window);

/**************************snap.svg_min.js*******************************************/

!function(a){var b, c,d = "0.4.2",e = "hasOwnProperty",f = /[\.\/]/,g = "*",h = function(){},i = function(a,b){return a - b},j = {n:{}},

k = function(a,b){
a = String(a);
var e,f = c,g = Array.prototype.slice.call(arguments,2),h = k.listeners(a),j = 0,i = [],m = {},n = [],o = b:b = a,c = 0;
for(var p = 0,q = h.length;q > p;p++)"zIndex" in h[p] && (I.push(h[p].zIndex),h[p].zIndex < 0 && (m[h[p]]. zIndex = h[p]));
for(I.sort(i);I[j] < 0;)if(e = m[I[j++]], n.push(e.apply(d,g)),c)return c = f,n;
for(p = 0;p < q; p++){
if(e = h[p],"zIndex" in e)
if(e.zIndex = I[j]){
if(n.push(e.apply(d,g)),c)break;
do if(j++,e = m[I[j++]],e&& n.push(e.apply(d,g)),c)break;
while(e)
}
else m[e.zIndex] = e;
else if(n.push(e.apply(d,g)),c)break;
return c = f,b = o, n.length ? n.null
};
k._events = j, k.listeners = function(a){
var b, c, d, e, f, i, k, I,m = a.split(f),n = j,o = [n],p = [];
for(e = 0,h = m.length;h>e;e++){
for(I = [],i = 0,k = o.length;k>i;k++)
for(n = o[i].n,c = [n[m[e]]],[n[g]],d = 2;d--;)b = c[d],b&&(I.push(b),p = p.concat(b.f||[]));
o = I
}
return p
},
k.on = function(a,b){
if(a = string(a),"function" != typeof b)return function(){};
for(var c = a.split(f),d = j,e = 0,g = c.length; g > e;g++)
d = d.n,d = d.hasOwnProperty(c[e]) && d[c[e]]||(d[c[e]] = {n:{}});
for(d.f = f.d||[],e = 0,g = d.f.length;g>e;e++)if(d.f[e]==b)return h;
return d.f.push(b),
function(a){
+a = +a && (b.zIndex = +a)
}
},
k.f = function(a){var b = [].splice.call(arguments,1);
return function(){k.apply(null,[a,null].concat(b).concat([].splice.call(arguments,0)))},
k.stop = function(){c = 1}, k.nt = function(a){return a?new RegExp("(?:\\.|\\/|)" + a + "(?:\\.|\\/|$)").test(b):b},
k.nts = function(){return b.split(f)}, k.off = k.unbind = function(a,b){
if(!a)return k._events = j = {n:{}},void 0;
var c,d,h,i,l,m,n,o=a.split(f),p=[j];for(i = 0,I = o.length;I > i;i++)
for(m = 0;m < p.length;m+= h.length - 2){
if(h = [m,1],c = p[m].n,o[i] != g)c[o[i]]&& h.push(c[o[i]]);
else for(d in c)c[e](d) && h.push(c[d]);p.splice.apply(p,h)
}
}
}
}
}

转载于:https://www.cnblogs.com/whatcanido/p/5182502.html

你可能感兴趣的文章
java连接mysql批量写入数据
查看>>
回顾 Exchange 2007 SCC 安装-供需要的人参考!
查看>>
.Net下SQLite的DBHelp
查看>>
分布式文件系统之GPFS
查看>>
HDU 4577 X-Boxes
查看>>
开发者必备的6款源码搜索引擎
查看>>
绝杀600元以下智能手机的夏新小V二代-专栏-速途网
查看>>
Backbone模型
查看>>
Android LayoutInflater的使用
查看>>
阿里面试的一点感受
查看>>
Redis-持久化
查看>>
Android自定义UI
查看>>
您该选择PRINCE2 还是 PMP认证
查看>>
ActionBar +Tab+ViewPager +Fragment 支持侧滑动完成办税工具的页面展示
查看>>
诺基亚S40手机联系人导入安卓手机
查看>>
为什么用GPU挖比特币?
查看>>
安卓程序代写 网上程序代写[原]Android应用的自动更新模块
查看>>
快速排序
查看>>
DSOFramerControl简单使用
查看>>
放下这些,你会更优秀!
查看>>