Web Interface For Lite Argus Control modules
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.

374 lines
11 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * VERSION: 1.16.1
  3. * DATE: 2018-08-27
  4. * UPDATES AND DOCS AT: http://greensock.com
  5. *
  6. * @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
  7. * This work is subject to the terms at http://greensock.com/standard-license or for
  8. * Club GreenSock members, the software agreement that was issued with your membership.
  9. *
  10. * @author: Jack Doyle, jack@greensock.com
  11. **/
  12. /* eslint-disable */
  13. import { _gsScope, globals, Ease, Linear, Power0, Power1, Power2, Power3, Power4 } from "./TweenLite.js";
  14. _gsScope._gsDefine("easing.Back", ["easing.Ease"], function() {
  15. var w = (_gsScope.GreenSockGlobals || _gsScope),
  16. gs = w.com.greensock,
  17. _2PI = Math.PI * 2,
  18. _HALF_PI = Math.PI / 2,
  19. _class = gs._class,
  20. _create = function(n, f) {
  21. var C = _class("easing." + n, function(){}, true),
  22. p = C.prototype = new Ease();
  23. p.constructor = C;
  24. p.getRatio = f;
  25. return C;
  26. },
  27. _easeReg = Ease.register || function(){}, //put an empty function in place just as a safety measure in case someone loads an OLD version of TweenLite.js where Ease.register doesn't exist.
  28. _wrap = function(name, EaseOut, EaseIn, EaseInOut, aliases) {
  29. var C = _class("easing."+name, {
  30. easeOut:new EaseOut(),
  31. easeIn:new EaseIn(),
  32. easeInOut:new EaseInOut()
  33. }, true);
  34. _easeReg(C, name);
  35. return C;
  36. },
  37. EasePoint = function(time, value, next) {
  38. this.t = time;
  39. this.v = value;
  40. if (next) {
  41. this.next = next;
  42. next.prev = this;
  43. this.c = next.v - value;
  44. this.gap = next.t - time;
  45. }
  46. },
  47. //Back
  48. _createBack = function(n, f) {
  49. var C = _class("easing." + n, function(overshoot) {
  50. this._p1 = (overshoot || overshoot === 0) ? overshoot : 1.70158;
  51. this._p2 = this._p1 * 1.525;
  52. }, true),
  53. p = C.prototype = new Ease();
  54. p.constructor = C;
  55. p.getRatio = f;
  56. p.config = function(overshoot) {
  57. return new C(overshoot);
  58. };
  59. return C;
  60. },
  61. Back = _wrap("Back",
  62. _createBack("BackOut", function(p) {
  63. return ((p = p - 1) * p * ((this._p1 + 1) * p + this._p1) + 1);
  64. }),
  65. _createBack("BackIn", function(p) {
  66. return p * p * ((this._p1 + 1) * p - this._p1);
  67. }),
  68. _createBack("BackInOut", function(p) {
  69. return ((p *= 2) < 1) ? 0.5 * p * p * ((this._p2 + 1) * p - this._p2) : 0.5 * ((p -= 2) * p * ((this._p2 + 1) * p + this._p2) + 2);
  70. })
  71. ),
  72. //SlowMo
  73. SlowMo = _class("easing.SlowMo", function(linearRatio, power, yoyoMode) {
  74. power = (power || power === 0) ? power : 0.7;
  75. if (linearRatio == null) {
  76. linearRatio = 0.7;
  77. } else if (linearRatio > 1) {
  78. linearRatio = 1;
  79. }
  80. this._p = (linearRatio !== 1) ? power : 0;
  81. this._p1 = (1 - linearRatio) / 2;
  82. this._p2 = linearRatio;
  83. this._p3 = this._p1 + this._p2;
  84. this._calcEnd = (yoyoMode === true);
  85. }, true),
  86. p = SlowMo.prototype = new Ease(),
  87. SteppedEase, ExpoScaleEase, RoughEase, _createElastic;
  88. p.constructor = SlowMo;
  89. p.getRatio = function(p) {
  90. var r = p + (0.5 - p) * this._p;
  91. if (p < this._p1) {
  92. return this._calcEnd ? 1 - ((p = 1 - (p / this._p1)) * p) : r - ((p = 1 - (p / this._p1)) * p * p * p * r);
  93. } else if (p > this._p3) {
  94. return this._calcEnd ? (p === 1 ? 0 : 1 - (p = (p - this._p3) / this._p1) * p) : r + ((p - r) * (p = (p - this._p3) / this._p1) * p * p * p); //added p === 1 ? 0 to avoid floating point rounding errors from affecting the final value, like 1 - 0.7 = 0.30000000000000004 instead of 0.3
  95. }
  96. return this._calcEnd ? 1 : r;
  97. };
  98. SlowMo.ease = new SlowMo(0.7, 0.7);
  99. p.config = SlowMo.config = function(linearRatio, power, yoyoMode) {
  100. return new SlowMo(linearRatio, power, yoyoMode);
  101. };
  102. //SteppedEase
  103. SteppedEase = _class("easing.SteppedEase", function(steps, immediateStart) {
  104. steps = steps || 1;
  105. this._p1 = 1 / steps;
  106. this._p2 = steps + (immediateStart ? 0 : 1);
  107. this._p3 = immediateStart ? 1 : 0;
  108. }, true);
  109. p = SteppedEase.prototype = new Ease();
  110. p.constructor = SteppedEase;
  111. p.getRatio = function(p) {
  112. if (p < 0) {
  113. p = 0;
  114. } else if (p >= 1) {
  115. p = 0.999999999;
  116. }
  117. return (((this._p2 * p) | 0) + this._p3) * this._p1;
  118. };
  119. p.config = SteppedEase.config = function(steps, immediateStart) {
  120. return new SteppedEase(steps, immediateStart);
  121. };
  122. //ExpoScaleEase
  123. ExpoScaleEase = _class("easing.ExpoScaleEase", function(start, end, ease) {
  124. this._p1 = Math.log(end / start);
  125. this._p2 = end - start;
  126. this._p3 = start;
  127. this._ease = ease;
  128. }, true);
  129. p = ExpoScaleEase.prototype = new Ease();
  130. p.constructor = ExpoScaleEase;
  131. p.getRatio = function(p) {
  132. if (this._ease) {
  133. p = this._ease.getRatio(p);
  134. }
  135. return (this._p3 * Math.exp(this._p1 * p) - this._p3) / this._p2;
  136. };
  137. p.config = ExpoScaleEase.config = function(start, end, ease) {
  138. return new ExpoScaleEase(start, end, ease);
  139. };
  140. //RoughEase
  141. RoughEase = _class("easing.RoughEase", function(vars) {
  142. vars = vars || {};
  143. var taper = vars.taper || "none",
  144. a = [],
  145. cnt = 0,
  146. points = (vars.points || 20) | 0,
  147. i = points,
  148. randomize = (vars.randomize !== false),
  149. clamp = (vars.clamp === true),
  150. template = (vars.template instanceof Ease) ? vars.template : null,
  151. strength = (typeof(vars.strength) === "number") ? vars.strength * 0.4 : 0.4,
  152. x, y, bump, invX, obj, pnt;
  153. while (--i > -1) {
  154. x = randomize ? Math.random() : (1 / points) * i;
  155. y = template ? template.getRatio(x) : x;
  156. if (taper === "none") {
  157. bump = strength;
  158. } else if (taper === "out") {
  159. invX = 1 - x;
  160. bump = invX * invX * strength;
  161. } else if (taper === "in") {
  162. bump = x * x * strength;
  163. } else if (x < 0.5) { //"both" (start)
  164. invX = x * 2;
  165. bump = invX * invX * 0.5 * strength;
  166. } else { //"both" (end)
  167. invX = (1 - x) * 2;
  168. bump = invX * invX * 0.5 * strength;
  169. }
  170. if (randomize) {
  171. y += (Math.random() * bump) - (bump * 0.5);
  172. } else if (i % 2) {
  173. y += bump * 0.5;
  174. } else {
  175. y -= bump * 0.5;
  176. }
  177. if (clamp) {
  178. if (y > 1) {
  179. y = 1;
  180. } else if (y < 0) {
  181. y = 0;
  182. }
  183. }
  184. a[cnt++] = {x:x, y:y};
  185. }
  186. a.sort(function(a, b) {
  187. return a.x - b.x;
  188. });
  189. pnt = new EasePoint(1, 1, null);
  190. i = points;
  191. while (--i > -1) {
  192. obj = a[i];
  193. pnt = new EasePoint(obj.x, obj.y, pnt);
  194. }
  195. this._prev = new EasePoint(0, 0, (pnt.t !== 0) ? pnt : pnt.next);
  196. }, true);
  197. p = RoughEase.prototype = new Ease();
  198. p.constructor = RoughEase;
  199. p.getRatio = function(p) {
  200. var pnt = this._prev;
  201. if (p > pnt.t) {
  202. while (pnt.next && p >= pnt.t) {
  203. pnt = pnt.next;
  204. }
  205. pnt = pnt.prev;
  206. } else {
  207. while (pnt.prev && p <= pnt.t) {
  208. pnt = pnt.prev;
  209. }
  210. }
  211. this._prev = pnt;
  212. return (pnt.v + ((p - pnt.t) / pnt.gap) * pnt.c);
  213. };
  214. p.config = function(vars) {
  215. return new RoughEase(vars);
  216. };
  217. RoughEase.ease = new RoughEase();
  218. //Bounce
  219. _wrap("Bounce",
  220. _create("BounceOut", function(p) {
  221. if (p < 1 / 2.75) {
  222. return 7.5625 * p * p;
  223. } else if (p < 2 / 2.75) {
  224. return 7.5625 * (p -= 1.5 / 2.75) * p + 0.75;
  225. } else if (p < 2.5 / 2.75) {
  226. return 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375;
  227. }
  228. return 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375;
  229. }),
  230. _create("BounceIn", function(p) {
  231. if ((p = 1 - p) < 1 / 2.75) {
  232. return 1 - (7.5625 * p * p);
  233. } else if (p < 2 / 2.75) {
  234. return 1 - (7.5625 * (p -= 1.5 / 2.75) * p + 0.75);
  235. } else if (p < 2.5 / 2.75) {
  236. return 1 - (7.5625 * (p -= 2.25 / 2.75) * p + 0.9375);
  237. }
  238. return 1 - (7.5625 * (p -= 2.625 / 2.75) * p + 0.984375);
  239. }),
  240. _create("BounceInOut", function(p) {
  241. var invert = (p < 0.5);
  242. if (invert) {
  243. p = 1 - (p * 2);
  244. } else {
  245. p = (p * 2) - 1;
  246. }
  247. if (p < 1 / 2.75) {
  248. p = 7.5625 * p * p;
  249. } else if (p < 2 / 2.75) {
  250. p = 7.5625 * (p -= 1.5 / 2.75) * p + 0.75;
  251. } else if (p < 2.5 / 2.75) {
  252. p = 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375;
  253. } else {
  254. p = 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375;
  255. }
  256. return invert ? (1 - p) * 0.5 : p * 0.5 + 0.5;
  257. })
  258. );
  259. //CIRC
  260. _wrap("Circ",
  261. _create("CircOut", function(p) {
  262. return Math.sqrt(1 - (p = p - 1) * p);
  263. }),
  264. _create("CircIn", function(p) {
  265. return -(Math.sqrt(1 - (p * p)) - 1);
  266. }),
  267. _create("CircInOut", function(p) {
  268. return ((p*=2) < 1) ? -0.5 * (Math.sqrt(1 - p * p) - 1) : 0.5 * (Math.sqrt(1 - (p -= 2) * p) + 1);
  269. })
  270. );
  271. //Elastic
  272. _createElastic = function(n, f, def) {
  273. var C = _class("easing." + n, function(amplitude, period) {
  274. this._p1 = (amplitude >= 1) ? amplitude : 1; //note: if amplitude is < 1, we simply adjust the period for a more natural feel. Otherwise the math doesn't work right and the curve starts at 1.
  275. this._p2 = (period || def) / (amplitude < 1 ? amplitude : 1);
  276. this._p3 = this._p2 / _2PI * (Math.asin(1 / this._p1) || 0);
  277. this._p2 = _2PI / this._p2; //precalculate to optimize
  278. }, true),
  279. p = C.prototype = new Ease();
  280. p.constructor = C;
  281. p.getRatio = f;
  282. p.config = function(amplitude, period) {
  283. return new C(amplitude, period);
  284. };
  285. return C;
  286. };
  287. _wrap("Elastic",
  288. _createElastic("ElasticOut", function(p) {
  289. return this._p1 * Math.pow(2, -10 * p) * Math.sin( (p - this._p3) * this._p2 ) + 1;
  290. }, 0.3),
  291. _createElastic("ElasticIn", function(p) {
  292. return -(this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * this._p2 ));
  293. }, 0.3),
  294. _createElastic("ElasticInOut", function(p) {
  295. return ((p *= 2) < 1) ? -0.5 * (this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * this._p2)) : this._p1 * Math.pow(2, -10 *(p -= 1)) * Math.sin( (p - this._p3) * this._p2 ) * 0.5 + 1;
  296. }, 0.45)
  297. );
  298. //Expo
  299. _wrap("Expo",
  300. _create("ExpoOut", function(p) {
  301. return 1 - Math.pow(2, -10 * p);
  302. }),
  303. _create("ExpoIn", function(p) {
  304. return Math.pow(2, 10 * (p - 1)) - 0.001;
  305. }),
  306. _create("ExpoInOut", function(p) {
  307. return ((p *= 2) < 1) ? 0.5 * Math.pow(2, 10 * (p - 1)) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
  308. })
  309. );
  310. //Sine
  311. _wrap("Sine",
  312. _create("SineOut", function(p) {
  313. return Math.sin(p * _HALF_PI);
  314. }),
  315. _create("SineIn", function(p) {
  316. return -Math.cos(p * _HALF_PI) + 1;
  317. }),
  318. _create("SineInOut", function(p) {
  319. return -0.5 * (Math.cos(Math.PI * p) - 1);
  320. })
  321. );
  322. _class("easing.EaseLookup", {
  323. find:function(s) {
  324. return Ease.map[s];
  325. }
  326. }, true);
  327. //register the non-standard eases
  328. _easeReg(w.SlowMo, "SlowMo", "ease,");
  329. _easeReg(RoughEase, "RoughEase", "ease,");
  330. _easeReg(SteppedEase, "SteppedEase", "ease,");
  331. return Back;
  332. }, true);
  333. export var Back = globals.Back;
  334. export var Elastic = globals.Elastic;
  335. export var Bounce = globals.Bounce;
  336. export var RoughEase = globals.RoughEase;
  337. export var SlowMo = globals.SlowMo;
  338. export var SteppedEase = globals.SteppedEase;
  339. export var Circ = globals.Circ;
  340. export var Expo = globals.Expo;
  341. export var Sine = globals.Sine;
  342. export var ExpoScaleEase = globals.ExpoScaleEase;
  343. export { Linear, Power0, Power1, Power2, Power3, Power4 };