From 7256878408f7616e084d0252a5eedf6b0f9387c1 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Wed, 28 Feb 2018 16:38:37 +0800 Subject: [PATCH] Scroll Text --- docs/event.md | 6 +++--- libs/core.js | 2 +- libs/events.js | 4 ++-- libs/ui.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/event.md b/docs/event.md index 34990c84..24803034 100644 --- a/docs/event.md +++ b/docs/event.md @@ -288,8 +288,8 @@ time为可选项,代表该自动文本的时间。可以不指定,不指定 ``` js "x,y": [ // 实际执行的事件列表 {"type": "setText", "title": [255,0,0], "text": [255,255,0], "background": [0,0,255,0.3]}, - {"type": "setText", "position": "up", "bold": true, "scroll": 70}, - "这段话将显示在上方,标题为红色,正文为黄色粗体,背景为透明度0.3的蓝色,70毫秒速度滚动" + {"type": "setText", "position": "up", "bold": true, "time": 70}, + "这段话将显示在上方,标题为红色,正文为黄色粗体,背景为透明度0.3的蓝色,70毫秒速度打字机效果" ] ``` @@ -303,7 +303,7 @@ position为可选项,表示设置文字显示位置。只能为up(上),c bold为可选项,如果设置则为true或false,表示正文是否使用粗体。 默认值:`false` -scroll为可选项,表示文字滚动的速度。若此项设置为0将直接全部显示,若大于0则会设置为相邻字符依次显示的时间间隔。 默认值:`50` +time为可选项,表示文字滚动的速度。若此项设置为0将直接全部显示,若大于0则会设置为相邻字符依次显示的时间间隔。 默认值:`50` ### tip:显示一段提示文字 diff --git a/libs/core.js b/libs/core.js index 867e0831..1769e9cc 100644 --- a/libs/core.js +++ b/libs/core.js @@ -132,7 +132,7 @@ function core() { "background": [0,0,0,0.85], "text": [255,255,255,1], "bold": false, - "scroll": 50, + "time": 50, }, 'curtainColor': null, 'usingCenterFly':false, diff --git a/libs/events.js b/libs/events.js index 2fd9391e..d1ef7e54 100644 --- a/libs/events.js +++ b/libs/events.js @@ -328,8 +328,8 @@ events.prototype.doAction = function() { if (core.isset(data.bold)) { core.status.textAttribute.bold=data.bold; } - if (core.isset(data.scroll)) { - core.status.textAttribute.scroll=data.scroll; + if (core.isset(data.time)) { + core.status.textAttribute.time=data.time; } core.events.doAction(); break; diff --git a/libs/ui.js b/libs/ui.js index 14507b3d..3fb52f61 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -242,7 +242,7 @@ ui.prototype.drawTextBox = function(content) { } - if (textAttribute.scroll<=0 || core.status.event.id!='action') { + if (textAttribute.time<=0 || core.status.event.id!='action') { drawContent(content); } else { @@ -252,7 +252,7 @@ ui.prototype.drawTextBox = function(content) { if (index==content.length) { clearInterval(core.status.event.interval); } - }, textAttribute.scroll); + }, textAttribute.time); } }