animation-player
v0.1.9arrow_drop_downv0.1.9
v0.1.8
v0.1.7
v0.1.6
v0.1.5
v0.1.4
v0.1.3
v0.1.2
v0.1.1
STATUS
Passing
DOWNLOADS
220
VISIBILITY
Public
PUBLISHED
4 years ago
SIZE
31 KB
1 contributor
Like
Install animation-player as a package?
Copied
npm i @bit/clui.nui-ui.ui.tutorial.animation-player
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
and packages in Bit or NPM to the example. any of the 1 million componentstoggle layout
modifieddraft
modifieddraft
chevron_left
chevron_right
Description
This component is for playing animation, support both sprite or sequence images animation.
Sprite animation
The old PrepL way of animation, a single sprite image contains all frames of the animation.
- Easy for FE module development, just one image to input.
- Approx 500kB for 14 frames @ 500 x 500px.
- Large file size if the sprite contains a lot of frames.
- All frames in the animation will be loaded once the page is loaded, will be heavy if the page shows multiple animations.
- extra steps to produce the sprite image.
Sequence animation
Each animation will be composed by a series of image files. Pass to the FE development with an array of file names.
- Easier to produce, no need to combine into one sprite sheet.
- More flexible to edit, can only edit one frame inside an animation sequence.
- Ability to load the first frame only, and loading the rest of frames after the user hit play button. Therefore well fit for large frames animation.
- more error prone, typo in one of the file names will break the whole animation sequence.
- Approx 50kB per frame @ 500 x 500px.
Image file requirements and specifications
- Any web image file format are accepted: jpg, gif, png, etc.
- Although image resolution is not a concern for this component, the old PrepL sprite sheet resolution is 500 x 500px, we can keep using the same resolution.
- Spritesheet composition is exactly the same as old PrepL, orders from left to right horizontally.
- The order of frames in the sequence animation, IS based on the order of file names inside the array, NOT based on the file name.
- All frames, no matter sprite or sequence, MUST BE SQUARE.
- Info for sprite animation when pass to FE dev: Sprite image URL, FPS, number of frames.
- Info for sequence animation when pass to FE dev: Array of file names, FPS.
Import from bit.dev
https://bit.dev/clui/nui-ui/ui/common/animation-player
yarn add @bit/clui.nui-ui.ui.common.animation-player
import AnimationPlayer from '@bit/clui.nui-ui.ui.common.animation-player';
Props
Below are the props defined for this component:
Name | Type | Default | Description |
---|---|---|---|
type* | ‘sequence’ | ‘sprite’ | - | - |
fileList | string[] | - | for ‘sequence’ type, an array of file names |
spriteURL | string | - | for ‘sprite’ type |
fps | number | 10 | frame per second, affect the playback speed |
frameNum | number | 1 | for ‘sprite’ type, the number of frames the sprite image contains |