anim8 your HTML elements
anim8js-dom modifies the animation definition and animator functions to include units. Any unit that the property supports in CSS is usable in anim8js - and can handle converting between different units. You can even animate between values with different units. The following functions have changed:
Animator.set( attrs )can set values with units like12pxor10%Animator.get( attrs )you can specify what unit you want an attribute to be returned inAnimator.ref( attr, desiredUnit, relativeTo )reference to an attributes value with the given unitAnimator.value( attr )returns the value of the attribute with its unitAnimator.tweenTo( attr, target, options, cache, unit )you can specify the target value unitAnimator.tweenManyTo( targets, options, cache, units )you can specify a map of units to match the map of target valuesAnimator.tweenFrom( attr, starting, options, cache, unit )you can specify the starting value unitAnimator.tweenManyFrom( startings, options, cache, units )you can specify a map of units to match the map of startingsAnimator.tween( attr, starts, ends, options, cache, unit )you can specity the unit for tweeningAnimator.tweenMany( starts, ends, options, cache, units )you can specify a map of units to match the map of startsAnimator.move( attr, amount, options, cache, unit )move by the given unitAnimator.moveMany( amounts, options, cache, units )move many by the given map of unitsAnimator.follow( attr, path, options, cache, unit )follow a path where the values in the path are the given unit
The animation definition has been modified to now include a units map like so:
anim8.save('animationName`, {
keyframe: {
'0,20,60,100': {
left: 50
},
'10,40,80`: {
left: 0
}
},
units: {
left: '%
}
});
Notes
relativeTois one of: parentWidth, parentHeight, width, height, fontSize, parentFontSize, or htmlFontSize and is used with using the%unit
- Bower:
bower install anim8js-dom - Node:
npm install anim8js-dom - Download: anim8js-dom
If a (type) isn't beside the property - assume a simple number type.
padding paddingTop paddingLeft paddingBottom paddingRight
margin marginTop marginLeft marginBottom marginRight
borderRadius borderTopLeftRadius borderTopRightRadius borderBottomLeftRadius borderBottomRightRadius
borderWidth borderTopWidth borderRightWidth borderBottomWidth borderLeftWidth
outlineWidth outlineOffset tabSize textIndent borderSpacing fontSize lineHeight letterSpacing wordSpacing
origin(2d) originX originY
opacity zIndex
width minWidth maxWidth height minHeight maxHeight
top right bottom left
blur sepia brightness grayscale contrast invert saturation heuRotate
rotate rotate3d(quaternion)
translate(2d) translateX translateY translateZ translate3d(3d)
scale(2d) scaleX scaleY scaleZ scale3d(3d)
skew(2d) skewX skewY
backface visibility
backgroundColor(rgba) color(rgba) borderTopColor(rgba) borderRightColor(rgba) borderBottomColor(rgba) borderLeftColor(rgba) borderColor(rgba) outlineColor(rgba) textDecorationColor(rgba)
textShadowX textShadowY textShadowPosition(2d) textShadowBlur textShadowColor(rgba)
shadowX shadowY shadowPosition(2d) shadowBlur shadowSpread shadowColor(rgba) shadowInset
scrollLeft scrollTop
center(2d) centerX centerY
angle distance orbitOffset(2d)
