-1

I use the tween.js library, it contains some built in easing functions such as this one:

Quadratic: {
    In: function (k) {
        return k * k;
    }
};

The user guide describes the variable k as:

  • k: the easing progress, or how far along the duration of the tween we are. Allowed values are in the range [0, 1].

My question is why k, what does this letter stand for? If I'd written the function myself, I'd have named it p meaning either progress or percentage.

Drahcir
  • 11,772
  • 24
  • 86
  • 128

2 Answers2

2

This Wikipedia article on naming conventions in mathematics (https://en.m.wikipedia.org/wiki/Latin_letters_used_in_mathematics) tells us that the lower case k represents:

• the unit prefix kilo- (10³)

• the Boltzmann constant, this is often represented as kB to avoid confusion with

•the Wavenumber of the wave equation

•an integer, e.g. a dummy variable in summations, or an index of a matrix.

•an unspecified (real) constant

•the spring constant of Hooke's law

•the spacetime Curvature from the Friedmann equations in cosmology

I would suggest that the fourth item is the most appropriate description of k in this instance.

an integer, e.g. a dummy variable in summations, or an index of a matrix.

If the author had reason to name the variable k perhaps this is it. If so, then 'k' doesn't 'stand for' anything but is merely a convention used by maths nerds ;)

Moob
  • 14,420
  • 1
  • 34
  • 47
2

Alright, I wrote the code (a classic simplification of the classic Penner easing equations), and honestly I don't remember why I chose k. It used to be my default variable name for a ratio between 0 and 1. No good reason come to my mind.

Philippe
  • 2,621
  • 1
  • 19
  • 20