-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathfat.light.js
14 lines (14 loc) · 3.28 KB
/
fat.light.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
FAT v0.6.8
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/fat
*/
'use strict';(function(u,l,p){var n;(n=p.define)&&n.amd?n([],function(){return l}):(n=p.modules)?n[u.toLowerCase()]=l:"object"===typeof exports?module.exports=l:p[u]=l})("Fat",function(){function u(a,c,b,d,e,f,v,g,m,h,l,r){this.i=a;this.B=a.j;this.style=c;this.G=c.replace(/([A-Z])/g,"-$1").toLowerCase();this.o=d;this.s=e;this.c=d;this.H=f;this.m=v;this.duration=g;this.h=m;this.ease=n(m)?[]:null;this.time=0;this.g=h;this.f=l;this.F=b;this.a=r;this.D="px"!==f}function l(){this.id=y++;this.stack=[];
this.u=p.bind(this);this.exec=this.b=0}function p(a){var c=this.stack,b=c.length;if(b){this.exec=requestAnimationFrame(this.u);this.b||(this.b=a);var d=!1;if(b)for(var e=0;e<b;e++){var f=c[e];f&&(d=!0,f.C(this,a)||(c[e]=null))}this.b=a;d||this.destroy()}}function n(a){return"string"===typeof a}function x(a){return"undefined"===typeof a}var w=Math.max(screen.width,screen.height),C=w*(window.devicePixelRatio||1),t=parseFloat,y=0,h=u.prototype;h.animate=function(a,c){var b=this.o,d=this.s,e=this.duration,
f=this.i,v=b===d||!1;a=this.time+=a-(c||a);c=a>=e;if(!v)if(c)var g=d;else{var m;if(m=this.ease)g=m.length?(d-b)*m[w/e*a+.5>>0]/C:(d-b)*a/e;else if(m=this.h)g=1===m.length?m(a/e):m(a,b,d,e);g=b+g;g=this.D?(g*w+.5>>0)/w:g+.5>>0}b=this.style;v||this.c===g||(this.c=g,g+=this.H,"custom"!==b&&(f.nodeType?this.A(g):f[b]=g));this.f&&this.f.call(f,c?1:a/e,g);c&&(this.time=-1,this.g&&this.g.call(f))};h.C=function(a,c){if(-1===this.time)this.i[this.F]=null;else{var b=c-a.b;if(this.a)if("view"===this.a)if(b=
this.i.getBoundingClientRect(),0<=b.top&&b.bottom<=window.innerHeight)this.a=0;else return!0;else{if(0<(this.a-=b))return!0;this.a=0}this.animate(c,a.b);return!0}};h.A=function(a){var c=this.B,b=this.G;this.m?c.setProperty(b,a,"important"):c.setProperty(b,a)};h.v=function(a,c,b,d,e,f,v,g){x(a)?a=this.c:a=t(a);n(c)&&(c=t(c));this.o=a;this.s=c;this.duration=d;this.time=0;this.m=b;this.h!==e&&(this.ease=n(e)?[]:null,this.h=e);this.g=f;this.f=v;this.a=g};h=l.prototype;h.w=function(a,c,b,d,e,f,v,g,m,h,
l,r){if("custom"===c)d=d||0;else if(a.nodeType){var q=a.j||(a.j=a.style);d=(x(d)?q[c]:d)||(a.l||(a.l=getComputedStyle(a)))[c]}else d=x(d)?a[c]:d;q=""+d;"auto"===q&&(q="0");d=t(q);if(n(e)){var k=e;e=t(e);f||(f=k.substring((""+e).length))}f||(f=q.substring((""+d).length));c=new u(a,c,b,d,e,f,v,g,m,h,l,r,!1,!1,!1);this.stack[this.stack.length]=c;a[b]=c};h.animate=function(a,c,b,d){b?"function"===typeof b&&(d=b,b={}):b={};n(a)?a=document.querySelectorAll(a):a.constructor===Array||(a=[a]);var e=b.delay,
f=b.duration||400,h=b.ease||"",g=Object.keys(c),m=g.length;d=d||b.callback||!1;var l=b.step,u=b.force;b=b.init;for(var r=0;r<m;r++){var q=g[r],k=c[q],p=void 0,w=void 0;k.constructor===Array?(p=k[0],w=k[2],k=k[1]):"object"===typeof k&&(e=k.delay||e,f=k.duration||f,h=k.ease||h,p=k.from,w=k.unit,k=k.to);for(var t=r===m-1,x="_fat_"+q+this.id,z=0,y=a.length;z<y;z++){var A=a[z];b&&0===r&&(A.l=null);var B=!b&&A[x];B?B.v(p,k,u,f,h,t&&d,t&&l,e):this.w(A,q,x,p,k,w,u,f,h,t&&d,t&&l,e)}}this.exec||(this.exec=
requestAnimationFrame(this.u));return this};h.destroy=function(){this.exec&&(this.exec=0,this.stack=[],this.b=0);return this};h.create=function(a){return new l(a)};return new l}(),this);