You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.5 KiB
79 lines
2.5 KiB
9 years ago
|
/**
|
||
|
* Created by jljsj on 15/9/16.
|
||
|
*/
|
||
|
var TweenMax = TweenMax, Motion = Motion;
|
||
|
$(function () {
|
||
|
var needData = ["/static/TweenMax.min.js", "/static/motion.js"];
|
||
|
var loadFunc = {
|
||
|
num: 0,
|
||
|
numSub: function (_callback) {
|
||
|
this.num++;
|
||
|
if (this.num >= needData.length) {
|
||
|
if (typeof _callback === 'function') {
|
||
|
_callback();
|
||
|
}
|
||
|
} else {
|
||
|
this.getLoad(_callback);
|
||
|
}
|
||
|
},
|
||
|
getLoad: function (_callback) {
|
||
|
var self = this, str = needData[self.num];
|
||
|
if (str.indexOf(".js") >= 0) {
|
||
|
if ((str.indexOf('TweenMax') >= 0 && TweenMax) || (str.indexOf('motion.js') >= 0 && Motion)) {
|
||
|
self.numSub(_callback)
|
||
|
} else {
|
||
9 years ago
|
$.getScript(rootUrl + str, function () {
|
||
9 years ago
|
self.numSub(_callback)
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
var callback = function () {
|
||
|
Motion.motionVideo.init()
|
||
|
},
|
||
|
scripts = document.getElementsByTagName("script"),
|
||
|
urlData = [];
|
||
|
for (var i = 0; i < scripts.length; i++) {
|
||
|
var sc = scripts[i].src, str = sc.split('?')[1];
|
||
|
if (sc.indexOf('motionDemoLoad.js') >= 0 && str) {
|
||
|
var d = str.split('&');
|
||
9 years ago
|
urlData = d.map(function (s) {
|
||
9 years ago
|
return {name: s.split('=')[0], param: s.split('=')[1]};
|
||
|
});
|
||
|
}
|
||
|
}
|
||
9 years ago
|
urlData.map(function (m) {
|
||
9 years ago
|
if (m.param === 'easing') {
|
||
|
callback = function () {
|
||
|
new Motion("#J-Linear", {
|
||
|
lineData: [{stroke: "#f2666c"}, {
|
||
|
stroke: "#71B5DE",
|
||
|
openEaseName: "easeInOutQuad",
|
||
|
endEaseName: "easeInOutQuad"
|
||
|
}], mask: false
|
||
|
});
|
||
|
new Motion("#J-Symmetric", {
|
||
|
lineData: [
|
||
|
{openEaseName: "easeInOutQuad", endEaseName: "null", stroke: "#f2666c"},
|
||
|
{stroke: "#71B5DE", openEaseName: "easeInOutCubic", endEaseName: "easeInOutCubic"}],
|
||
|
mask: false, exposure: "top"
|
||
|
});
|
||
|
new Motion("#J-Entry", {
|
||
|
lineData: [
|
||
|
{openEaseName: "easeOutQuad", endEaseName: "easeOutQuad", stroke: "#f2666c"},
|
||
|
{stroke: "#71B5DE", openEaseName: "easeOutCubic", endEaseName: "easeInCubic"}],
|
||
|
mask: true, exposure: "bottom"
|
||
|
});
|
||
|
new Motion("#J-Back", {
|
||
|
lineData: [
|
||
|
{openEaseName: "easeOutBounce", endEaseName: "easeOutElastic", stroke: "#70f266"},
|
||
|
{stroke: "#71B5DE", openEaseName: "easeOutBack", endEaseName: "easeInOutBack"}],
|
||
|
mask: false, exposure: "top"
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
loadFunc.getLoad(callback);
|
||
|
});
|