Math.exp(x) returns e raised to the power of x, where e is approximately 2.71828 and is the base of the natural logarithm. Use it when a value should grow exponentially rather than by equal fixed increments. section 3.2.4
For frontend work, CSS exp(x) provides the same calculation directly in a style rule. Math.exp() is the JavaScript equivalent when the calculation must support browsers lacking the newer CSS function. section 3.2.4
Exponential growth animation
Scale an element from 1 to exp(1) to exp(2). Each stage increases by an exponential calculation, producing a growth effect rather than a linear size progression. section 3.2.4
Listing 3.8 Simulating exponential growth with exp()
@keyframes exponential-growth {
0% { transform: scale(1); }
50% { transform: scale(exp(1)); } #1
100% { transform: scale(exp(2)); } #2
}
.grow {
animation: exponential-growth 2s linear infinite;
}
Inspect the keyframes to see exp(1) and exp(2) used as transform scale values. section 3.2.4
