TrickComponent
最低版本: 1.4.0最后更新: 2020/10/21组件功能:
用于机器人小动作,该组件的参数列表继承于 BaseRobotProps
支持平台:
平台 | 是否支持 |
豹小秘 | 是 |
豹花/大瓶 | 是 |
豹小秘 Mini | 是 |
参数
属性 | JS类型 | Java类型 | 默认值 | 必填 | 说明 | 最低版本 |
getTrickStartText | () => string | 无 | ()=>'' | no | 获取小动作前的语音播放文案的方法(当返回值为undefined或''时,不播放语音,支持版本1.9.2) | 1.4.0 |
emojiPlayType | EMOJI_TYPE | 无 | undefine | no | 要使用的表情类别 | 1.4.0 |
emojiPlayContents | EmojiPlayContent[] | 无 | [] | no | 表情内容数组 | 1.4.0 |
headMotion | string | String | undefine | yes | 头部动作序列的json string | 1.4.0 |
结果码
返回结果 | 描述 |
TrickStatus.NORMAL_FINISH | 小动作正常结束 |
错误码
返回错误 | 描述 |
TrickStatus.MOTION_ERROR | 执行动作发生异常,小动作结束 |
状态码
返回状态 | 描述 |
TrickStatus.MUSIC_ERROR | 播放音乐发生异常 |
TrickStatus.MUSIC_NO_RESOURCE | 没有音频文件 |
TrickStatus.MOTION_NO_RESOURCE | 没有动作资源 |
示例代码
{isShowTrick ? (
<TrickComponent
headMotion={HEAD_BLINK}
getTrickStartText={'你好呀'}
emojiPlayType={EMOJI_TYPE.LOOK_AROUND}
onFinish={this.viewModel && this.viewModel.onHeadTurnGroupFinish}
/>
) : null}
export const HEAD_BLINK = `[
{
"horizontalAngle": 50,
"verticalAngle": 70,
"verticalMaxSpeed": 20,
"horizontalMaxSpeed": 80,
"horizontalMode": absolute,
"verticalMode": absolute
},{
"horizontalAngle": -50,
"verticalAngle": 70,
"verticalMaxSpeed": 20,
"horizontalMaxSpeed": 80,
"horizontalMode": absolute,
"verticalMode": absolute
},{
"horizontalAngle": 0,
"verticalAngle": 70,
"verticalMaxSpeed": 20,
"horizontalMaxSpeed": 80,
"horizontalMode": absolute,
"verticalMode": absolute
}
]`;
public onHeadTurnGroupFinish = (event?: ComponentEvent): boolean => {
return true;
};
说明:EmojiPlayContent 类定义,在 EmojiPlayerView 中