
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
anim-sequence
Advanced tools
Simple Animation Controller with Timeline
Document and Examples https://anseki.github.io/anim-sequence/
Simple lightweight library for high performance animation in a web page, makes preparations for each frame and calls the frames with optimized timeline for animation.
AnimSequence.addanimId = AnimSequence.add(valueCallback, frameCallback, duration, count, timing, reverse, timeRatio)
Add new animation, and return animId that is used to start and remove the animation.
For example:
animId = AnimSequence.add(
function(outputRatio) {
return 80 + (680 - 80) * outputRatio + 'px';
},
function(value) {
element.style.left = value;
},
3000, 0, 'ease-in-out');
Arguments:
valueCallbackType: function or undefined
Default: undefined
value = valueCallback(outputRatio)
A function that returns a value that is used to draw each frame.
For high performance animation, the function is called for all frames before the animation starts. That is, it makes preparations for each value that is used to draw the frame.
outputRatio is a number ranging from 0 to 1 to calculate a value.
The function can return something that is used to draw an frame. The value can be an Object or Array that contains multiple values.
For example, move an element rightward, it changes a left CSS property, from 80px to 680px.
// Return `80px` when `outputRatio` is `0%` (0), `680px` when `outputRatio` is `100%` (1).
function(outputRatio) {
// This value is used by `frameCallback` to draw a frame.
return 80 + (680 - 80) * outputRatio + 'px';
}
frameCallbackType: function
toNext = frameCallback(value, finish, timeRatio, outputRatio)
A function that draws a frame.
The function is called when it should draw a frame, it draws a frame with passed arguments.
value is something that was returned by valueCallback.finish is true if the function should draw a last frame.timeRatio is a number ranging from 0 to 1 to indicate the progress time of the animation played. It means also the ratio of the progress time and duration.outputRatio is the same as an argument of valueCallback.If the function returns false, stop the animation forcedly.
For example, move an element rightward, it changes a left CSS property.
function(value, finish, timeRatio, outputRatio) {
element.style.left = value; // It was already calculated by `valueCallback`.
if (finish) {
element.style.backgroundColor = 'red'; // Change the color to red at the right.
}
}
durationType: number
A number determining how long (milliseconds) the animation will run.
countType: number
Default: 0
A number of times the animation should repeat. The animation will repeat forever if 0 is specified.
timingType: Array or string
An Array that is [x1, y1, x2, y2] as a "timing function" that indicates how to change the speed. It works same as that of CSS animation.
You can specify one of the following keywords also. These values mean keywords for common timing functions.
easelinearease-inease-outease-in-outreverseType: boolean
Default: false
The animation plays backward if true is specified.
It can be specified by AnimSequence.start also.
timeRatioType: number or boolean
Default: 0
A number ranging from 0 to 1 to play from the midst or false that prevents it starting.
It can be specified by AnimSequence.start also.
AnimSequence.removeAnimSequence.remove(animId)
Remove an animation.
Arguments:
animIdType: number
The animId that was returned by AnimSequence.add.
AnimSequence.startAnimSequence.start(animId, reverse, timeRatio)
Start an animation.
Arguments:
animIdType: number
The animId that was returned by AnimSequence.add.
reverseType: boolean
Default: false
The animation plays backward if true is specified.
timeRatioType: number
Default: 0
A number ranging from 0 to 1 to play from the midst.
AnimSequence.stoptimeRatio = AnimSequence.stop(animId, getTimeRatioByFrame)
Stop an animation.
timeRatio is a number ranging from 0 to 1 for restarting the animation from the frame that was stopped.
Arguments:
animIdType: number
The animId that was returned by AnimSequence.add.
getTimeRatioByFrameType: boolean
Default: false
If true is specified, return timeRatio of the last played frame.
AnimSequence.validTimingisValid = AnimSequence.validTiming(timing)
Check whether an Array or string as timing is valid.
FAQs
Simple Animation Controller with Timeline
The npm package anim-sequence receives a total of 11 weekly downloads. As such, anim-sequence popularity was classified as not popular.
We found that anim-sequence demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.