# Interface: ICreateAnimateImagesOptions
# Indexable
▪ [key: string]: any
其他数据.
# Table of contents
# Properties
- canvasHeight
- canvasWidth
- directionReverse
- draw
- drawFrame
- frameCount
- from
- fromImage
- spriteHeight
- spriteWidth
- to
- yAxis
# Properties
# canvasHeight
• Optional
canvasHeight: number
画片高(2的n次幂,如2,4,8, 16, 32....).默认32
# canvasWidth
• Optional
canvasWidth: number
画片宽(2的n次幂,如2,4,8, 16, 32....).默认64
# directionReverse
• Optional
directionReverse: boolean
方向是否反向.
# draw
• Optional
draw: (context
: CanvasRenderingContext2D, width
: number, height
: number, opts
: ICreateAnimateImagesOptions) => void
绘制内容回调(此函数只需绘制第一帧,其作帧图片会根据移动方向和帧数自动计算出来).
# Type declaration
▸ (context
: CanvasRenderingContext2D, width
: number, height
: number, opts
: ICreateAnimateImagesOptions): void
# Parameters
Name | Type |
---|---|
context | CanvasRenderingContext2D |
width | number |
height | number |
opts | ICreateAnimateImagesOptions |
Returns: void
# drawFrame
• Optional
drawFrame: (context
: CanvasRenderingContext2D, width
: number, height
: number, frameCount
: number, curFrameIndex
: number, opts
: ICreateAnimateImagesOptions) => void
每帧内容回调(此函数每帧都会调用,需要根据不同的帧数生成不同的图片,与上面的draw冲突,如果设置了drawFrame,则上面的draw函数无效).
# Type declaration
▸ (context
: CanvasRenderingContext2D, width
: number, height
: number, frameCount
: number, curFrameIndex
: number, opts
: ICreateAnimateImagesOptions): void
# Parameters
Name | Type |
---|---|
context | CanvasRenderingContext2D |
width | number |
height | number |
frameCount | number |
curFrameIndex | number |
opts | ICreateAnimateImagesOptions |
Returns: void
# frameCount
• Optional
frameCount: number
要生成的动画图片帧的个数.默认2
# from
• Optional
from: number
生成的动画图片集中从第几个开始,默认0.
# fromImage
• Optional
fromImage: HTMLImageElement
来源图片.
# spriteHeight
• Optional
spriteHeight: number
来源图片中精灵图所占高.
# spriteWidth
• Optional
spriteWidth: number
来源图片中精灵图所占宽.
# to
• Optional
to: number
生成的动画图片集中到第几个结束,默认数组最后一个..
# yAxis
• Optional
yAxis: boolean
是否y方向生成动画图片集.