Sierpinski triangle html canvas Implementation
Good things:

const is used for variables that shouldn't be re-assigned
requestAnimationFrame() is used for animating
constants and global variables are declared at the top of the script.
only three functions are used

Suggestions

add a space after control structures like if for readability: this is recommended in many style guides (e.g. AirBnB, Google)
Instead of

if(gradientAnimation)


Add a space:
if (gradientAnimation)


Also recommended by some popular style guides: avoid var unless a global variable is needed. Default to using const to avoid accidental re-assignment (which seems to be a topic of this discussion on your other JS post). If re-assignment is needed then use let.

Use equality operators that don’t coerce types when not needed: 
Instead of:

if(iterations == maxIterations)


Use ===
 if (iterations === maxIterations)


A common convention in many languages (including C-based and others) is to have constants that truly never change named using ALL_CAPS - e.g. MAX_ITERATIONS instead of maxIterations, HALF_TRIANGLE_SIDE instead of halfTriangleSide, etc.

the lone i++ at the start of fractal() can be moved down to conditional after the call to drawTriangle() and converted to a pre-increment:
    if (++i &lt; iterations)


Most of the (idiomatic) JS code and JS Style guides I have seen have opening braces on the same line as the function signature or control structure instead of a new line. Perhaps having them on a new line is common in another style guide (e.g. C++, C#, etc.).