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.

69 lines
1.8 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * VERSION: 0.1.3
  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 } from "./TweenLite.js";
  14. export var EndArrayPlugin = _gsScope._gsDefine.plugin({
  15. propName: "endArray",
  16. API: 2,
  17. version: "0.1.3",
  18. //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
  19. init: function(target, value, tween) {
  20. var i = value.length,
  21. a = this.a = [],
  22. start, end;
  23. this.target = target;
  24. this._mod = 0;
  25. if (!i) {
  26. return false;
  27. }
  28. while (--i > -1) {
  29. start = target[i];
  30. end = value[i];
  31. if (start !== end) {
  32. a.push({i:i, s:start, c:end - start});
  33. }
  34. }
  35. return true;
  36. },
  37. mod: function(lookup) {
  38. if (typeof(lookup.endArray) === "function") {
  39. this._mod = lookup.endArray;
  40. }
  41. },
  42. //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
  43. set: function(ratio) {
  44. var target = this.target,
  45. a = this.a,
  46. i = a.length,
  47. mod = this._mod,
  48. e, val;
  49. if (mod) {
  50. while (--i > -1) {
  51. e = a[i];
  52. target[e.i] = mod(e.s + e.c * ratio, target);
  53. }
  54. } else {
  55. while (--i > -1) {
  56. e = a[i];
  57. val = e.s + e.c * ratio;
  58. target[e.i] = (val < 0.000001 && val > -0.000001) ? 0 : val;
  59. }
  60. }
  61. }
  62. });
  63. export { EndArrayPlugin as default };