ertdfgcvb/Sequencer
关于
A fast(?) fullscreen image-sequence player
设计与媒体实测星标增长
- 24小时
- 0
- 7天
- +13
- 15天
- +13
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Sequencer
A fast(?) fullscreen image-sequence player.
Demos
- Pig (drag)
- Bell (drag)
- Footballer (drag)
- Marble (drag)
- Clouds (hover)
- Parisienne (hover over an area)
Tests
How to use
The minimum parameters are two filenames of an image sequence or an array of filenames (or images).
In the first case the parser tries to figure out the filename pattern:
const s1 = Sequencer.make({
from : 'sequences/pig/DSC04701.JPG',
to : 'sequences/pig/DSC04775.JPG',
})
…or just a plain numerical sequence:
const s2 = Sequencer.make({
from : 'sequences/dog/1.png',
to : 'sequences/dog/100.png',
})
…or with a provided list of filenames:
const s3 = Sequencer.make({
list : [
'1a.png',
'1b.png',
'2.png',
'3.PNG',
'4.jpg',
'img7.png',
'final.jpg'
]
})
The list can also contain already created images (Image, ImageBitmap or canvas elements), mixed with filenames.
Area
With area the hover (and the drag start) is limited to a rect, defined in image pixels so it sticks to the same spot of the image regardless of canvas size and scaleMode. showArea draws it on top of the image, for debugging:
const s4 = Sequencer.make({
from : 'sequences/parisienne/dsc09467.jpg',
to : 'sequences/parisienne/dsc09563.jpg',
playMode : 'hover',
area : {x:175, y:440, w:605, h:130},
showArea : true,
})
Options
const opts = {
canvas : null, // A valid canvas element
// (will be created if null)
list : [], // An array of paths to the images to load
// (or of images);
// as an alternative the three options
// 'from', 'to' and 'step' below
// can be used to fill the array
// programmatically
from : '1.jpg', // First file of the sequence
to : '10.jpg', // Last file of the sequence
// (if lower than 'from' the sequence
// is reversed)
step : 1, // Increment: to load only even images
// use 2, etc.
scaleMode : 'cover', // Can be: auto, cover, contain
// (as in CSS)
direction : 'x', // Can be: x, -x, y, -y
// and determines the pointer direction,
// applies only if playMode
// is drag or hover
playMode : 'drag', // Can be: none, drag, hover, auto
loop : 'loop', // Can be: loop, pong, none
interval : 10, // Interval in milliseconds
// between each frame,
// applies only if playMode is auto;
// if set to zero tries to update
// at every frame event
autoLoad : 'all', // Can be: all, first, none;
// if first or none is used the loading
// needs to be triggered manually
// with load()
fitFirstImage : false, // Resizes the canvas to the size of
// the first loaded image
// in the sequence
showLoadedImages : false, // Show images while loading
// the sequence, may be jumpy because
// of async loading
pixelsPerFrame : 10, // Drag distance (in pixels)
// per frame, can be < 1, but must be > 0
hiDPI : true, // Use hiDPI if present
smoothing : true, // Sets the context's
// imageSmoothingEnabled flag
area : null, // {x, y, w, h} in image pixels:
// limits hover (and drag start)
// to this rect
showArea : false, // Draws the area (debug)
imageLoad : function, // Callback for each image load
queueComplete : function, // Callback for queue complete
}
Changelog
3.1.0
- pointer events (mouse, touch and pen)
- add destroy()
- add loop 'none'
- drag respects the loop option
- reverse sequences (from > to)
- accept images in list
- add area and showArea
- rename dragAmount to pixelsPerFrame
- fix autoLoad 'first' skipping an image
- fix loading stalling on image errors
- fix drag wrap-around and hover mapping on scaled canvas
- fix parser for unpadded sequences starting at 0
- fix package.json syntax
- decode images while preloading
3.0.1
- fix bug (last image not loaded)
- add makefile
3.0
- better parser
- remove utils.js
- use rollup.js for compression
- minified version is a module
2.1
- update to ECMAScript 2015 (aka ES6)
- script is now an ES6 module (may need transpiling for legacy support) and loaded as such in the examples
2.0
- multiple instances
- better parser (automatic leading zeroes detection)
- canvas only (2d)
- incremental drag
- removed default loader (a custom one can be implemented via callback)
- cover frame
Todo
- accept a spritesheet as parameter
Author
Andreas Gysin ertdfgcvb.xyz
探索相关项目
加载中…