UNPKG

1.78 kBTypeScriptView Raw
1import { ComponentType } from 'react'
2import { StandardProps } from './common'
3interface AnimationVideoProps extends StandardProps {
4 /** 组件使用的 video 视频资源的宽度(单位:px)
5 * @supported swan
6 * @default 800
7 */
8 resourceWidth?: number
9
10 /** 组件使用的 video 视频资源的高度(单位:px)
11 * @supported swan
12 * @default 400
13 */
14 resourceHeight?: number
15
16 /** 用于设置动画画布的 CSS 样式
17 * @supported swan
18 * @default "width: 400px;height: 400px"
19 */
20 canvasStyle?: string
21
22 /** 动画资源地址,支持相对路径以及远程地址。如果是远程路径,注意 response header 里需要设置 Access-Control-Allow-Origin 来防止跨域问题
23 * @supported swan
24 */
25 path?: string
26
27 /** 动画是否循环播放
28 * @supported swan
29 * @default false
30 */
31 loop?: boolean
32
33 /** 动画是否自动播放
34 * @supported swan
35 * @default false
36 */
37 autoplay?: boolean
38
39 /** 视频资源中 alpha 通道的方向,left 表示 alpha 通道在资源的左边,right 表示 alpha 通道在资源的右边。详情请参考透明视频设计资源示例
40 * @supported swan
41 * @default "left"
42 */
43 alphaDirection?: string
44
45 /** 动画开始播放的回调
46 * @supported swan
47 */
48 onStarted?: CommonEventFunction
49
50 /** 当播放到末尾时触发 ended 事件(自然播放结束会触发回调,循环播放结束及暂停动画不会触发)
51 * @supported swan
52 */
53 onEnded?: CommonEventFunction
54}
55
56/** 透明视频动画
57 * @classification media
58 * @supported swan
59 * @see https://smartprogram.baidu.com/docs/develop/component/animation-video/
60 */
61declare const AnimationVideo: ComponentType<AnimationVideoProps>
62export { AnimationVideo, AnimationVideoProps }