Elastic property

Map<ETTypes, num Function(num, [num?])> Elastic
getter/setter pair

Implementation

static Map<ETTypes,num Function(num,[num?])> Elastic = {
  ETTypes.In:(amount,[power]) {
    if (amount == 0) {
      return 0;
    }
    if (amount == 1) {
      return 1;
    }
    return -math.pow(2, 10 * (amount - 1)) * math.sin((amount - 1.1) * 5 * math.pi);
  },
  ETTypes.Out:(amount,[power]) {
    if (amount == 0) {
      return 0;
    }
    if (amount == 1) {
      return 1;
    }
    return math.pow(2, -10 * amount) * math.sin((amount - 0.1) * 5 * math.pi) + 1;
  },
  ETTypes.InOut:(amount,[power]) {
    if (amount == 0) {
      return 0;
    }
    if (amount == 1) {
      return 1;
    }
    amount *= 2;
    if (amount < 1) {
      return -0.5 * math.pow(2, 10 * (amount - 1)) * math.sin((amount - 1.1) * 5 * math.pi);
    }
    return 0.5 * math.pow(2, -10 * (amount - 1)) * math.sin((amount - 1.1) * 5 * math.pi) + 1;
  },
};