a simple animation library implemented by javascript
// fromTo
fly.animation({
action: fly.action.fromTo(
el, {width: 0},{width: 100}
)
})
// to
fly.animation({
action: fly.action.to(
el, {width: 100}
)
})
fly.animation({
duration: 5000,
action: fly.action.to(
el, {width: 100}
)
})
reset 1 means the animation will not reset initial state finally.
reset 2 means the animation will reset initial state in the final.
reset 3 meas the animation will do a loop then reset 1.
reset Infinity means the animation will loop forever.
fly.animation({
reset: 2,
action: fly.action.to(
el, {width: 100}
)
})
default strategy is linear
you can choose other strategy just type "fly.STRATEGY.[easeIn,easeOut...etc]" to choose
fly.animation({
strategy: fly.STRATEGY.easeInCubic,
action: fly.action.to(
el, {width: 100}
)
})
begin function use to callback the beginning
fly.animation({
begin: () => {console.log("begin")},
action: fly.action.to(
el, {width: 100}
)
})
end function use to callback the ending
fly.animation(
end: () => {console.log("ending")},
action: fly.action.to(
el, {width: 100}
)
)
fly.animation(
race: (progress, reset) => {
// here you can define when stop animation
},
action: fly.action.to(
el, {width: 100}
)
)
fly.animation(
action: (_progress) => {
// you operate dom in here, _progress is progress dealt by strategy method
}
)
fly.animation(
strategy: (progress) => {
// here, use a variety of algorithms process progress
},
action: fly.action.to(
el, {width: 100}
)
)