From 57972ca8879491fc61e8c505d48a6d18bc512b7d Mon Sep 17 00:00:00 2001 From: Molo Date: Thu, 13 Feb 2014 02:23:09 +0100 Subject: [PATCH] build --- Gruntfile.js | 6 +- build/angular-easing.js | 280 +++++++++++++++++++++++++++++++++++ build/angular-easing.min.js | 7 + build/ng-smoothscroll.js | 98 ------------ build/ng-smoothscroll.min.js | 7 - 5 files changed, 290 insertions(+), 108 deletions(-) create mode 100644 build/angular-easing.js create mode 100644 build/angular-easing.min.js delete mode 100644 build/ng-smoothscroll.js delete mode 100644 build/ng-smoothscroll.min.js diff --git a/Gruntfile.js b/Gruntfile.js index dad432c..d7ee5ac 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -80,8 +80,8 @@ module.exports = function(grunt) { report: 'gzip' }, build: { - src: 'build/ng-smoothscroll.js', - dest: 'build/ng-smoothscroll.min.js' + src: 'build/angular-easing.js', + dest: 'build/angular-easing.min.js' } }, @@ -125,7 +125,7 @@ module.exports = function(grunt) { banner: '<%= banner %>' }, files: { - 'build/ng-smoothscroll.js': 'src/ng-smoothscroll.js', + 'build/angular-easing.js': 'src/angular-easing.js', } } }, diff --git a/build/angular-easing.js b/build/angular-easing.js new file mode 100644 index 0000000..a0fe4a2 --- /dev/null +++ b/build/angular-easing.js @@ -0,0 +1,280 @@ +(function() { + "use strict"; + angular.module("Easie", []).service("Easie", function() { + var Easie; + Easie = (function() { + function Easie() {} + + Easie.backIn = function(time, begin, change, duration, overshoot) { + if (overshoot == null) { + overshoot = 1.70158; + } + return change * (time /= duration) * time * ((overshoot + 1) * time - overshoot) + begin; + }; + + Easie.backOut = function(time, begin, change, duration, overshoot) { + if (overshoot == null) { + overshoot = 1.70158; + } + return change * ((time = time / duration - 1) * time * ((overshoot + 1) * time + overshoot) + 1) + begin; + }; + + Easie.backInOut = function(time, begin, change, duration, overshoot) { + if (overshoot == null) { + overshoot = 1.70158; + } + if ((time = time / (duration / 2)) < 1) { + return change / 2 * (time * time * (((overshoot *= 1.525) + 1) * time - overshoot)) + begin; + } else { + return change / 2 * ((time -= 2) * time * (((overshoot *= 1.525) + 1) * time + overshoot) + 2) + begin; + } + }; + + Easie.bounceOut = function(time, begin, change, duration) { + if ((time /= duration) < 1 / 2.75) { + return change * (7.5625 * time * time) + begin; + } else if (time < 2 / 2.75) { + return change * (7.5625 * (time -= 1.5 / 2.75) * time + 0.75) + begin; + } else if (time < 2.5 / 2.75) { + return change * (7.5625 * (time -= 2.25 / 2.75) * time + 0.9375) + begin; + } else { + return change * (7.5625 * (time -= 2.625 / 2.75) * time + 0.984375) + begin; + } + }; + + Easie.bounceIn = function(time, begin, change, duration) { + return change - Easie.bounceOut(duration - time, 0, change, duration) + begin; + }; + + Easie.bounceInOut = function(time, begin, change, duration) { + if (time < duration / 2) { + return Easie.bounceIn(time * 2, 0, change, duration) * 0.5 + begin; + } else { + return Easie.bounceOut(time * 2 - duration, 0, change, duration) * 0.5 + change * 0.5 + begin; + } + }; + + Easie.circIn = function(time, begin, change, duration) { + return -change * (Math.sqrt(1 - (time = time / duration) * time) - 1) + begin; + }; + + Easie.circOut = function(time, begin, change, duration) { + return change * Math.sqrt(1 - (time = time / duration - 1) * time) + begin; + }; + + Easie.circInOut = function(time, begin, change, duration) { + if ((time = time / (duration / 2)) < 1) { + return -change / 2 * (Math.sqrt(1 - time * time) - 1) + begin; + } else { + return change / 2 * (Math.sqrt(1 - (time -= 2) * time) + 1) + begin; + } + }; + + Easie.cubicIn = function(time, begin, change, duration) { + return change * (time /= duration) * time * time + begin; + }; + + Easie.cubicOut = function(time, begin, change, duration) { + return change * ((time = time / duration - 1) * time * time + 1) + begin; + }; + + Easie.cubicInOut = function(time, begin, change, duration) { + if ((time = time / (duration / 2)) < 1) { + return change / 2 * time * time * time + begin; + } else { + return change / 2 * ((time -= 2) * time * time + 2) + begin; + } + }; + + Easie.elasticOut = function(time, begin, change, duration, amplitude, period) { + var overshoot; + if (amplitude == null) { + amplitude = null; + } + if (period == null) { + period = null; + } + if (time === 0) { + return begin; + } else if ((time = time / duration) === 1) { + return begin + change; + } else { + if (period == null) { + period = duration * 0.3; + } + if ((amplitude == null) || amplitude < Math.abs(change)) { + amplitude = change; + overshoot = period / 4; + } else { + overshoot = period / (2 * Math.PI) * Math.asin(change / amplitude); + } + return (amplitude * Math.pow(2, -10 * time)) * Math.sin((time * duration - overshoot) * (2 * Math.PI) / period) + change + begin; + } + }; + + Easie.elasticIn = function(time, begin, change, duration, amplitude, period) { + var overshoot; + if (amplitude == null) { + amplitude = null; + } + if (period == null) { + period = null; + } + if (time === 0) { + return begin; + } else if ((time = time / duration) === 1) { + return begin + change; + } else { + if (period == null) { + period = duration * 0.3; + } + if ((amplitude == null) || amplitude < Math.abs(change)) { + amplitude = change; + overshoot = period / 4; + } else { + overshoot = period / (2 * Math.PI) * Math.asin(change / amplitude); + } + time -= 1; + return -(amplitude * Math.pow(2, 10 * time)) * Math.sin((time * duration - overshoot) * (2 * Math.PI) / period) + begin; + } + }; + + Easie.elasticInOut = function(time, begin, change, duration, amplitude, period) { + var overshoot; + if (amplitude == null) { + amplitude = null; + } + if (period == null) { + period = null; + } + if (time === 0) { + return begin; + } else if ((time = time / (duration / 2)) === 2) { + return begin + change; + } else { + if (period == null) { + period = duration * (0.3 * 1.5); + } + if ((amplitude == null) || amplitude < Math.abs(change)) { + amplitude = change; + overshoot = period / 4; + } else { + overshoot = period / (2 * Math.PI) * Math.asin(change / amplitude); + } + if (time < 1) { + return -0.5 * (amplitude * Math.pow(2, 10 * (time -= 1))) * Math.sin((time * duration - overshoot) * ((2 * Math.PI) / period)) + begin; + } else { + return amplitude * Math.pow(2, -10 * (time -= 1)) * Math.sin((time * duration - overshoot) * (2 * Math.PI) / period) + change + begin; + } + } + }; + + Easie.expoIn = function(time, begin, change, duration) { + if (time === 0) { + return begin; + } + return change * Math.pow(2, 10 * (time / duration - 1)) + begin; + }; + + Easie.expoOut = function(time, begin, change, duration) { + if (time === duration) { + return begin + change; + } + return change * (-Math.pow(2, -10 * time / duration) + 1) + begin; + }; + + Easie.expoInOut = function(time, begin, change, duration) { + if (time === 0) { + return begin; + } else if (time === duration) { + return begin + change; + } else if ((time = time / (duration / 2)) < 1) { + return change / 2 * Math.pow(2, 10 * (time - 1)) + begin; + } else { + return change / 2 * (-Math.pow(2, -10 * (time - 1)) + 2) + begin; + } + }; + + Easie.linearNone = function(time, begin, change, duration) { + return change * time / duration + begin; + }; + + Easie.linearIn = function(time, begin, change, duration) { + return Easie.linearNone(time, begin, change, duration); + }; + + Easie.linearOut = function(time, begin, change, duration) { + return Easie.linearNone(time, begin, change, duration); + }; + + Easie.linearInOut = function(time, begin, change, duration) { + return Easie.linearNone(time, begin, change, duration); + }; + + Easie.quadIn = function(time, begin, change, duration) { + return change * (time = time / duration) * time + begin; + }; + + Easie.quadOut = function(time, begin, change, duration) { + return -change * (time = time / duration) * (time - 2) + begin; + }; + + Easie.quadInOut = function(time, begin, change, duration) { + if ((time = time / (duration / 2)) < 1) { + return change / 2 * time * time + begin; + } else { + return -change / 2 * ((time -= 1) * (time - 2) - 1) + begin; + } + }; + + Easie.quartIn = function(time, begin, change, duration) { + return change * (time = time / duration) * time * time * time + begin; + }; + + Easie.quartOut = function(time, begin, change, duration) { + return -change * ((time = time / duration - 1) * time * time * time - 1) + begin; + }; + + Easie.quartInOut = function(time, begin, change, duration) { + if ((time = time / (duration / 2)) < 1) { + return change / 2 * time * time * time * time + begin; + } else { + return -change / 2 * ((time -= 2) * time * time * time - 2) + begin; + } + }; + + Easie.quintIn = function(time, begin, change, duration) { + return change * (time = time / duration) * time * time * time * time + begin; + }; + + Easie.quintOut = function(time, begin, change, duration) { + return change * ((time = time / duration - 1) * time * time * time * time + 1) + begin; + }; + + Easie.quintInOut = function(time, begin, change, duration) { + if ((time = time / (duration / 2)) < 1) { + return change / 2 * time * time * time * time * time + begin; + } else { + return change / 2 * ((time -= 2) * time * time * time * time + 2) + begin; + } + }; + + Easie.sineIn = function(time, begin, change, duration) { + return -change * Math.cos(time / duration * (Math.PI / 2)) + change + begin; + }; + + Easie.sineOut = function(time, begin, change, duration) { + return change * Math.sin(time / duration * (Math.PI / 2)) + begin; + }; + + Easie.sineInOut = function(time, begin, change, duration) { + return -change / 2 * (Math.cos(Math.PI * time / duration) - 1) + begin; + }; + + return Easie; + + })(); + return Easie; + }); + +}).call(this); diff --git a/build/angular-easing.min.js b/build/angular-easing.min.js new file mode 100644 index 0000000..0cec97f --- /dev/null +++ b/build/angular-easing.min.js @@ -0,0 +1,7 @@ +/*! + * angular-easing v0.0.0 + * + * Copyright (c) 2014 + * License: BSD-2-Clause + */ +(function(){"use strict";angular.module("Easie",[]).service("Easie",function(){var a;return a=function(){function a(){}return a.backIn=function(a,b,c,d,e){return null==e&&(e=1.70158),c*(a/=d)*a*((e+1)*a-e)+b},a.backOut=function(a,b,c,d,e){return null==e&&(e=1.70158),c*((a=a/d-1)*a*((e+1)*a+e)+1)+b},a.backInOut=function(a,b,c,d,e){return null==e&&(e=1.70158),(a/=d/2)<1?c/2*a*a*(((e*=1.525)+1)*a-e)+b:c/2*((a-=2)*a*(((e*=1.525)+1)*a+e)+2)+b},a.bounceOut=function(a,b,c,d){return(a/=d)<1/2.75?7.5625*c*a*a+b:2/2.75>a?c*(7.5625*(a-=1.5/2.75)*a+.75)+b:2.5/2.75>a?c*(7.5625*(a-=2.25/2.75)*a+.9375)+b:c*(7.5625*(a-=2.625/2.75)*a+.984375)+b},a.bounceIn=function(b,c,d,e){return d-a.bounceOut(e-b,0,d,e)+c},a.bounceInOut=function(b,c,d,e){return e/2>b?.5*a.bounceIn(2*b,0,d,e)+c:.5*a.bounceOut(2*b-e,0,d,e)+.5*d+c},a.circIn=function(a,b,c,d){return-c*(Math.sqrt(1-(a/=d)*a)-1)+b},a.circOut=function(a,b,c,d){return c*Math.sqrt(1-(a=a/d-1)*a)+b},a.circInOut=function(a,b,c,d){return(a/=d/2)<1?-c/2*(Math.sqrt(1-a*a)-1)+b:c/2*(Math.sqrt(1-(a-=2)*a)+1)+b},a.cubicIn=function(a,b,c,d){return c*(a/=d)*a*a+b},a.cubicOut=function(a,b,c,d){return c*((a=a/d-1)*a*a+1)+b},a.cubicInOut=function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a+b:c/2*((a-=2)*a*a+2)+b},a.elasticOut=function(a,b,c,d,e,f){var g;return null==e&&(e=null),null==f&&(f=null),0===a?b:1===(a/=d)?b+c:(null==f&&(f=.3*d),null==e||ea?-.5*e*Math.pow(2,10*(a-=1))*Math.sin((a*d-g)*(2*Math.PI/f))+b:e*Math.pow(2,-10*(a-=1))*Math.sin(2*(a*d-g)*Math.PI/f)+c+b)},a.expoIn=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b},a.expoOut=function(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},a.expoInOut=function(a,b,c,d){return 0===a?b:a===d?b+c:(a/=d/2)<1?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*(a-1))+2)+b},a.linearNone=function(a,b,c,d){return c*a/d+b},a.linearIn=function(b,c,d,e){return a.linearNone(b,c,d,e)},a.linearOut=function(b,c,d,e){return a.linearNone(b,c,d,e)},a.linearInOut=function(b,c,d,e){return a.linearNone(b,c,d,e)},a.quadIn=function(a,b,c,d){return c*(a/=d)*a+b},a.quadOut=function(a,b,c,d){return-c*(a/=d)*(a-2)+b},a.quadInOut=function(a,b,c,d){return(a/=d/2)<1?c/2*a*a+b:-c/2*((a-=1)*(a-2)-1)+b},a.quartIn=function(a,b,c,d){return c*(a/=d)*a*a*a+b},a.quartOut=function(a,b,c,d){return-c*((a=a/d-1)*a*a*a-1)+b},a.quartInOut=function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a+b:-c/2*((a-=2)*a*a*a-2)+b},a.quintIn=function(a,b,c,d){return c*(a/=d)*a*a*a*a+b},a.quintOut=function(a,b,c,d){return c*((a=a/d-1)*a*a*a*a+1)+b},a.quintInOut=function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a*a+b:c/2*((a-=2)*a*a*a*a+2)+b},a.sineIn=function(a,b,c,d){return-c*Math.cos(a/d*(Math.PI/2))+c+b},a.sineOut=function(a,b,c,d){return c*Math.sin(a/d*(Math.PI/2))+b},a.sineInOut=function(a,b,c,d){return-c/2*(Math.cos(Math.PI*a/d)-1)+b},a}()})}).call(this); \ No newline at end of file diff --git a/build/ng-smoothscroll.js b/build/ng-smoothscroll.js deleted file mode 100644 index 20b6493..0000000 --- a/build/ng-smoothscroll.js +++ /dev/null @@ -1,98 +0,0 @@ -(function() { - angular.module("SmoothScroll", []).factory("SmoothScroll", [ - "$q", function($q) { - var SmoothScroll, getElementTop; - getElementTop = function(elem) { - var tempEl, yPos; - yPos = elem.offsetTop; - tempEl = elem.offsetParent; - while (tempEl != null) { - yPos += tempEl.offsetTop; - tempEl = tempEl.offsetParent; - } - return yPos; - }; - SmoothScroll = function(start_y, stop_y, defer) { - var distance, down, i, leap_y, speed, step, timer, up, _results; - distance = (stop_y > start_y ? stop_y - start_y : start_y - stop_y); - if (distance < 100) { - scrollTo(0, stop_y); - defer.resolve(leap_y); - return; - } - speed = Math.round(distance / 100); - if (speed > 20) { - speed = 20; - } - step = Math.round(distance / 25); - leap_y = (stop_y > start_y ? start_y + step : start_y - step); - timer = 0; - down = function(leap_y, timer, end) { - return setTimeout(function() { - scrollTo(0, leap_y); - if (leap_y >= end) { - return defer.resolve(leap_y); - } - }, timer * speed); - }; - up = function(leap_y, timer, end) { - return setTimeout(function() { - scrollTo(0, leap_y); - if (leap_y <= end) { - return defer.resolve(leap_y); - } - }, timer * speed); - }; - if (stop_y > start_y) { - i = start_y; - while (i < stop_y) { - down(leap_y, timer, stop_y); - leap_y += step; - if (leap_y > stop_y) { - leap_y = stop_y; - } - timer++; - i += step; - } - } - i = start_y; - _results = []; - while (i > stop_y) { - up(leap_y, timer, stop_y); - leap_y -= step; - if (leap_y < stop_y) { - leap_y = stop_y; - } - timer++; - _results.push(i -= step); - } - return _results; - }; - return { - $goTo: function(y, x) { - var defer, _ref; - if (((_ref = y[0]) != null ? _ref.tagName : void 0) != null) { - y = getElementTop(y[0]); - } - if (y.tagName != null) { - y = getElementTop(y); - } - if (typeof y === "string") { - y = getElementTop(document.querySelector(y)); - } - defer = $q.defer(); - SmoothScroll(window.pageYOffset, y, defer); - return defer.promise.then(void 0, function(final_x) { - if (final_x == null) { - final_x = window.pageYOffset; - } - return window.onload = function() { - return scrollTo(0, final_x); - }; - }); - } - }; - } - ]); - -}).call(this); diff --git a/build/ng-smoothscroll.min.js b/build/ng-smoothscroll.min.js deleted file mode 100644 index d577b19..0000000 --- a/build/ng-smoothscroll.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * angular-smooth-scroll v0.0.0 - * - * Copyright (c) 2014 - * License: BSD-2-Clause - */ -(function(){angular.module("SmoothScroll",[]).factory("SmoothScroll",["$q",function(a){var b,c;return c=function(a){var b,c;for(c=a.offsetTop,b=a.offsetParent;null!=b;)c+=b.offsetTop,b=b.offsetParent;return c},b=function(a,b,c){var d,e,f,g,h,i,j,k,l;if(d=b>a?b-a:a-b,100>d)return scrollTo(0,b),void c.resolve(g);if(h=Math.round(d/100),h>20&&(h=20),i=Math.round(d/25),g=b>a?a+i:a-i,j=0,e=function(a,b,d){return setTimeout(function(){return scrollTo(0,a),a>=d?c.resolve(a):void 0},b*h)},k=function(a,b,d){return setTimeout(function(){return scrollTo(0,a),d>=a?c.resolve(a):void 0},b*h)},b>a)for(f=a;b>f;)e(g,j,b),g+=i,g>b&&(g=b),j++,f+=i;for(f=a,l=[];f>b;)k(g,j,b),g-=i,b>g&&(g=b),j++,l.push(f-=i);return l},{$goTo:function(d){var e,f;return null!=(null!=(f=d[0])?f.tagName:void 0)&&(d=c(d[0])),null!=d.tagName&&(d=c(d)),"string"==typeof d&&(d=c(document.querySelector(d))),e=a.defer(),b(window.pageYOffset,d,e),e.promise.then(void 0,function(a){return null==a&&(a=window.pageYOffset),window.onload=function(){return scrollTo(0,a)}})}}}])}).call(this); \ No newline at end of file