{duration, curve}. duration is in seconds (default 0.25; 0 makes the changes without animating them). curve is "linear", "easeIn", "easeOut", "easeInOut" (the default), or a cubic bezier [x1, y1, x2, y2] like CSS's cubic-bezier(), with x1 and x2 between 0 and 1
A function that changes canvases
A Promise that resolves once the animation has finished: true if every change ran to completion, or false if any was interrupted (by another change to the same attribute, its element or attribute being removed, or its canvas being destroyed)
Animate changes to one or more canvases
Calls
changesstraight away, and animates every change it makes to a canvas from its current value to the new one, overoptions.durationseconds. The changes can be to any number of elements, on any number of canvases, and all animate together.Inside
changes, these animate:setElementAttribute(),assignElement()(each attribute that differs),rotateElement(),rotateElementAroundPoint()andsetElementTransformation():frame,center,radius,coordinates(with the same number of points),rotation,rotationPoint,transformation,strokeWidth,startAngle,endAngle,roundedRectRadii,textSize,imageAlpha,canvasAlpha,fillColor,strokeColor,textColor,fillGradientColors(with the same number of colors),fillGradientAngleandfillGradientCentersetTransformation()andclearTransformation()setFrame(),setTopLeft(),setSize()andsetAlpha(), while the canvas is showingEverything else (e.g.
text,type,action, or adding and removing elements) changes immediately, as it does outsideanimate(). A number and a percentage animate between each other (e.g. aframewidth of"100%"to50).Getters return the new values as soon as
changesreturns, not the values being drawn part way through the animation. Mouse tracking follows what's drawn.Changing an attribute that's already animating (inside or outside another
animate()) replaces that animation, starting from where it had got to on screen. Calls can be nested: changes inside a nested call use its options.If
changesthrows, the error propagates to the caller, and the changes made before the error still animate.