Constructor
new BigMath_Timer()
Properties:
| Name | Type | Description |
|---|---|---|
timerEndSound |
string | 倒计时音频“要抓紧时间了哦~”,自动补全前缀audio_ 默认timerEndSound |
endSoundPercentage |
number | 百分之几提示音频“要抓紧时间了哦~” 默认0.3 |
playEndSound |
boolean | 是否播放倒计时音频“要抓紧时间了哦~” |
timeSprite |
string | 计时器组件资源名称 - 默认:image-gameScene_timer |
textConfig |
object | 计时器文字配置 |
timeCountSound |
string | 倒计时音效 |
textConfig.x |
number | 文字位置x - 默认:205.45745125612848 |
textConfig.y |
number | 文字位置y - 默认:67.41621621621623 |
textConfig.textStyle |
object | 文字样式 - 默认:{ fontSize: 55, fill: 0x204931, fontFamily: "Microsoft Yahei", fontWeight: "bold", breakWords: true, wordWrap: true, wordWrapWidth: 1120 } |
Example
import {Easy} from "pubtool4pixi"
let timer = Easy.create("BigMath_Timer",{
parentContainer:stage
});
timer.show();
timer.start(800);
timer.addEventOnce("timeup",()=>{
console.log("timeup");
});
setTimeout(()=>{
timer.stop();
},1000);
Extends
Methods
(static) continue()
继续计时
(static) pause()
暂停计时
(static) rewind(快进时间长度,单位秒)
快进
Parameters:
| Name | Type | Description |
|---|---|---|
快进时间长度,单位秒 |
number |
(static) rewind(快退时间长度,单位秒)
快退
Parameters:
| Name | Type | Description |
|---|---|---|
快退时间长度,单位秒 |
number |
(static) start(计时长度,单位秒)
开始计时
Parameters:
| Name | Type | Description |
|---|---|---|
计时长度,单位秒 |
number |
(static) stop()
停止计时
Events
onTimeRun
fired while timer run.
Properties:
| Name | Type | Description |
|---|---|---|
timeleft |
number |
timeup
fired after timer stop.