帧动画重置

This commit is contained in:
草莓 2025-04-11 11:51:20 +08:00
parent 5cb5eb63eb
commit 9c574fc486
4 changed files with 719 additions and 513 deletions

View File

@ -963,6 +963,7 @@ action
| addPop_s | addPop_s
| setq_s | setq_s
| setcgs_s | setcgs_s
| animationDrawable_s
| over_s | over_s
| overlist_s | overlist_s
| cgtextList_s | cgtextList_s
@ -1072,6 +1073,97 @@ if (block.isCollapsed() || !block.isEnabled() || pos || Int_0 || Bool_0) {
return code+',\n'; return code+',\n';
*/; */;
animationDrawable_s
: '帧动画' '总显示帧数' IntString '底色' ColorString? Colour '底色不透明度' IntString? BGNL?Newline
'图片序列同一帧后面覆盖先前的默认起始帧为0结束帧为最后一帧)'BGNL?Newline
'(剪裁区域不填写为全图,绘制区域不填写为全画面)'BGNL?Newline
'(不透明度100为不透明默认为不透明结束不透明度默认与开始透明度相同'BGNL?Newline
animationDrawableimage+? Newline
'音频序列(到达对应帧进行播放)'BGNL?Newline
animationDrawablesound+? Newline
/* animationDrawable_s
tooltip : animationDrawable帧动画图片叠加
helpUrl : /_docs/#/instruction
default : [30,"0, 0, 0",'rgb(0, 0, 0)',""]
allImages : ['EvalString_0']
colour : this.imageColor
if (IntString_1&&(IntString_1 < 0||IntString_1>100)) throw new Error('透明度范围为0-100,0为透明100为不透明,不填默认为不透明')
ColorString_0 = ColorString_0 ? (', "color": ['+ColorString_0+']') : '';
IntString_1 = IntString_1 ? (', "globalAlpha": '+IntString_1+'') : '';
var imageList=animationDrawableimage_0?',"imageList": [\n'+animationDrawableimage_0.slice(0,-1)+'\n]':''
var soundList=animationDrawablesound_0?',"soundList": [\n'+animationDrawablesound_0.slice(0,-1)+'\n]':''
var code = '{"type": "animationDrawable", "allFarme": '+IntString_0+ColorString_0+IntString_1+imageList+soundList+'},\n';
return code;
*/;
animationDrawableList
: animationDrawableimage
| animationDrawablesound
| animationDrawabletextEmpty;
animationDrawableimage
: '图片' EvalString? '起始帧' IntString? '起始不透明度' IntString? BGNL? Newline
'剪裁坐标cx' IntString? 'cy' IntString? '宽' IntString? '高' IntString? '绘制坐标x'IntString? 'y' IntString? '宽' IntString? '高' IntString? BGNL? Newline
'结束帧' IntString? '结束不透明度' IntString? '剪裁坐标cx' IntString? 'cy' IntString? '宽' IntString? '高' IntString? '绘制坐标x'IntString? 'y' IntString? '宽' IntString? '高' IntString? Newline
/* animationDrawableimage
tooltip : 帧动画图片列表
helpUrl : /_docs/#/instruction
default : ["","","","","","","","","","","","","","","","","","","","",""]
colour : this.subColor
allImages : ['EvalString_0']
if (IntString_1&&(IntString_1 < 0||IntString_1>100)) throw new Error('不透明度范围为0-100,0为透明,100为不透明,不填默认为不透明')
if (IntString_11&&(IntString_11 < 0||IntString_11>100)) throw new Error('不透明度范围为0-100,0为透明,100为不透明,不填默认为不透明')
IntString_0 = IntString_0 ? (', "beforefarme": '+IntString_0+'') : '';
IntString_1 = IntString_1 ? (', "globalAlpha": '+IntString_1+'') : '';
IntString_2 = IntString_2 ? (', "cx": '+IntString_2+'') : '';
IntString_3 = IntString_3 ? (', "cy": '+IntString_3+'') : '';
IntString_4 = IntString_4 ? (', "cw": '+IntString_4+'') : '';
IntString_5 = IntString_5 ? (', "ch": '+IntString_5+'') : '';
IntString_6 = IntString_6 ? (', "x": '+IntString_6+'') : '';
IntString_7 = IntString_7 ? (', "y": '+IntString_7+'') : '';
IntString_8 = IntString_8 ? (', "w": '+IntString_8+'') : '';
IntString_9 = IntString_9 ? (', "h": '+IntString_9+'') : '';
IntString_10 = IntString_10 ? (', "afterfarme": '+IntString_10+'') : '';
IntString_11 = IntString_11 ? (', "aglobalAlpha": '+IntString_11+'') : '';
IntString_12 = IntString_12 ? (', "acx": '+IntString_12+'') : '';
IntString_13 = IntString_13 ? (', "acy": '+IntString_13+'') : '';
IntString_14 = IntString_14 ? (', "acw": '+IntString_14+'') : '';
IntString_15 = IntString_15 ? (', "ach": '+IntString_15+'') : '';
IntString_16 = IntString_16 ? (', "ax": '+IntString_16+'') : '';
IntString_17 = IntString_17 ? (', "ay": '+IntString_17+'') : '';
IntString_18 = IntString_18 ? (', "aw": '+IntString_18+'') : '';
IntString_19 = IntString_19 ? (', "ah": '+IntString_19+'') : '';
return '{ "image":"'+EvalString_0+'"'+IntString_0+IntString_1+IntString_2+IntString_3+IntString_4+IntString_5+IntString_6+IntString_7+IntString_8+IntString_9+IntString_10+IntString_11+IntString_12+IntString_13+IntString_14+IntString_15+IntString_16+IntString_17+IntString_18+IntString_19+'},'
*/;
animationDrawablesound
: '音效' EvalString? '起始帧' IntString '是否停止其他音效'Bool? Newline
/* animationDrawablesound
tooltip : 帧动画配音
helpUrl : /_docs/#/instruction
default : ["",0,false]
colour : this.subColor
allSounds : ['EvalString_0']
return '{ "sound":"'+EvalString_0+'","startfarme":'+IntString_0+',"stopbefore":'+Bool_0+'},'
*/;
animationDrawabletextEmpty
: Newline
/* animationDrawabletextEmpty
var code = [];
return code;
*/;
over_s over_s
: '旁白文字' ':' EvalString BGNL? Newline : '旁白文字' ':' EvalString BGNL? Newline
'背景' EvalString? '回忆滤镜' Bool? '持续帧数' Int? '渐入渐出帧数' Int? '音频文件' EvalString? BGNL? Newline '背景' EvalString? '回忆滤镜' Bool? '持续帧数' Int? '渐入渐出帧数' Int? '音频文件' EvalString? BGNL? Newline
@ -2001,10 +2093,10 @@ drawWarning_s
/* drawWarning_s /* drawWarning_s
tooltip : drawWarning: 绘制warning警告并拉进镜头,本事件为异步事件,下一事件将在3100ms后执行 tooltip : drawWarning: 绘制warning警告并拉进镜头,本事件为异步事件,下一事件将在3100ms后执行
helpUrl : /_docs/#/instruction helpUrl : /_docs/#/instruction
default : [0, 0,'2',24,"这里是提示内容","绿色史莱姆",false] default : [0, 0,2,24,"这里是提示内容","绿色史莱姆",false]
colour : this.soundColor colour : this.soundColor
selectPoint : ["PosString_0", "PosString_1"] selectPoint : ["PosString_0", "PosString_1"]
if(!EvalString_1||!/^(0|([1-9][0-9]*))(\.[\d]+)?$/.test(EvalString_1))throw new Error("此项仅能填写小数或整数"); if(!EvalString_1||!/^(0|([1-9][0-9]*))(\.[\d]+)?$/.test(EvalString_0))throw new Error("此项仅能填写小数或整数");
var code = '{"type": "drawWarning", "x": '+PosString_0+', "y": '+PosString_1+',"large":'+EvalString_0+',"size":'+Int_0+',"text": "'+EvalString_1+'", "text2": "'+EvalString_2+'", "warning": '+Bool_0+'},\n'; var code = '{"type": "drawWarning", "x": '+PosString_0+', "y": '+PosString_1+',"large":'+EvalString_0+',"size":'+Int_0+',"text": "'+EvalString_1+'", "text2": "'+EvalString_2+'", "warning": '+Bool_0+'},\n';
return code; return code;
*/; */;

View File

@ -1017,6 +1017,62 @@ MotaActionParser = function () {
]); ]);
} }
break; break;
case "animationDrawable":
var buildanimationDrawableimage = function (obj) {
obj = MotaActionFunctions.processanimationDrawableimage(obj || []);
var res = null;
for (var ii = obj.length - 1, one; (one = obj[ii]); ii--) {
res = MotaActionBlocks["animationDrawableimage"].xmlText([
one[0],
one[1],
one[2],
one[3],
one[4],
one[5],
one[6],
one[7],
one[8],
one[9],
one[10],
one[11],
one[12],
one[13],
one[14],
one[15],
one[16],
one[17],
one[18],
one[19],
one[20],
res,
]);
}
return res;
};
var buildanimationDrawablesound = function (obj) {
obj = MotaActionFunctions.processanimationDrawablesound(obj || []);
var res = null;
for (var ii = obj.length - 1, one; (one = obj[ii]); ii--) {
res = MotaActionBlocks["animationDrawablesound"].xmlText([
one[0],
one[1],
one[2],
res,
]);
}
return res;
};
this.next = MotaActionBlocks["animationDrawable_s"].xmlText([
data.allFarme,
data.color,
"rgba(" + data.color + ")",
data.globalAlpha,
buildanimationDrawableimage(data.imageList),
buildanimationDrawablesound(data.soundList),
this.next,
]);
break;
case "jumpHero": // 跳跃勇士 case "jumpHero": // 跳跃勇士
if (data.dxy) { if (data.dxy) {
this.next = MotaActionBlocks["jumpHero_1_s"].xmlText([ this.next = MotaActionBlocks["jumpHero_1_s"].xmlText([
@ -3104,6 +3160,43 @@ MotaActionParser = function () {
return str; return str;
}; };
MotaActionFunctions.processanimationDrawableimage = function (overList) {
var list = [];
overList.forEach(function (one) {
list.push([
one.image,
one.beforefarme,
one.globalAlpha,
one.cx,
one.cy,
one.cw,
one.ch,
one.x,
one.y,
one.w,
one.h,
one.afterfarme,
one.aglobalAlpha,
one.acx,
one.acy,
one.acw,
one.ach,
one.ax,
one.ay,
one.aw,
one.ah,
]);
});
return list;
};
MotaActionFunctions.processanimationDrawablesound = function (overList) {
var list = [];
overList.forEach(function (one) {
list.push([one.sound, one.startfarme, one.stopbefore]);
});
return list;
};
MotaActionFunctions.replaceFromName = function (str) { MotaActionFunctions.replaceFromName = function (str) {
if (!str || MotaActionFunctions.disableReplace) return str; if (!str || MotaActionFunctions.disableReplace) return str;
var map = {}, var map = {},

View File

@ -284,6 +284,29 @@ main.floors.jiaocheng02=
"type": "hide", "type": "hide",
"remove": true "remove": true
} }
],
"3,8": [
{
"type": "animationDrawable",
"allFarme": 30,
"color": [
0,
0,
0
],
"imageList": [
{
"image": ""
}
],
"soundList": [
{
"sound": "",
"startfarme": 0,
"stopbefore": false
}
]
}
] ]
}, },
"changeFloor": { "changeFloor": {

View File

@ -2774,6 +2774,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
const uictx = main.dom.outerUI.getContext("2d"); const uictx = main.dom.outerUI.getContext("2d");
let now = 0; let now = 0;
core.registerAnimationFrame("lightFloor", true, function (timestamp) { core.registerAnimationFrame("lightFloor", true, function (timestamp) {
if(!core.status.floorId)return
if (timestamp - now > 1000 / 60) { if (timestamp - now > 1000 / 60) {
now = timestamp; now = timestamp;
globalAlphafloor += globalAlphafloorStatus; globalAlphafloor += globalAlphafloorStatus;
@ -4763,16 +4764,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
90 // 默认显示时长(帧数) 90 // 默认显示时长(帧数)
); );
}; };
let time = 0;
// 注册每帧事件 // 注册每帧事件
core.registerAnimationFrame("ShowDamagePop", true, (temptime) => { core.registerAnimationFrame("ShowDamagePop", true, (temptime) => {
if (temptime - time > 1000 / 60) {
time = temptime;
Dove.MorePerform.ShowDamagePop.Update.bind( Dove.MorePerform.ShowDamagePop.Update.bind(
Dove.MorePerform.ShowDamagePop Dove.MorePerform.ShowDamagePop
)(); )();
}
}); });
// 弹出精灵类 // 弹出精灵类
@ -4878,9 +4876,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
var textRect = uiContext.measureText(this._text); var textRect = uiContext.measureText(this._text);
this._width = textRect.width + 4; this._width = textRect.width + 4;
this._height = this._fontSize + 4; // 动态设置高度 this._height = this._fontSize + 4; // 动态设置高度
this._z = uiContext.canvas.style.zIndex this._z = uiContext.canvas.style.zIndex ?
? Number(uiContext.canvas.style.zIndex) + PopSprite._count Number(uiContext.canvas.style.zIndex) + PopSprite._count :
: PopSprite._baseZOrder + PopSprite._count; PopSprite._baseZOrder + PopSprite._count;
this._symbol = "popSprite" + PopSprite._count++; this._symbol = "popSprite" + PopSprite._count++;
this._alive = true; this._alive = true;
this._vx = this._speedX; // 使用传入的水平速度 this._vx = this._speedX; // 使用传入的水平速度
@ -4899,7 +4897,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this._alive = false; this._alive = false;
core.deleteCanvas(this._symbol); core.deleteCanvas(this._symbol);
}; };
}, },
"编辑器显伤": function () { "编辑器显伤": function () {
// 在此增加新插件 // 在此增加新插件
/////// 用户设置 /////// /////// 用户设置 ///////
@ -15368,13 +15366,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}); });
if (count > 0) list.splice(0, count); if (count > 0) list.splice(0, count);
} }
let now = 0;
if (!main.replayChecking) if (!main.replayChecking)
core.registerAnimationFrame("pop", true, (temptime) => { core.registerAnimationFrame("pop", true, (temptime) => {
if (temptime - now > 1000 / 60) {
now = temptime;
pop(); pop();
}
}); });
/** 添加弹出内容 */ /** 添加弹出内容 */
@ -15408,7 +15403,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (!core.status.pop) core.status.pop = [data]; if (!core.status.pop) core.status.pop = [data];
else core.status.pop.push(data); else core.status.pop.push(data);
}; };
}, },
"warning": function () { "warning": function () {
// 默认音效名 // 默认音效名
var defaultSound = "jingbao.mp3"; var defaultSound = "jingbao.mp3";
@ -15524,7 +15519,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// }); // });
}, 1600); }, 1600);
}; };
}, },
"滑动转场": function () { "滑动转场": function () {
// 在此增加新插件 // 在此增加新插件
const defaultChange = { const defaultChange = {
@ -19595,7 +19590,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
const ctx = over.getContext("2d"); const ctx = over.getContext("2d");
over.style.display = "block"; over.style.display = "block";
let farme = 0;
let now = 0; let now = 0;
let start = 0 let start = 0
core.registerAnimationFrame( core.registerAnimationFrame(
@ -19603,12 +19598,18 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
"animationDrawable", "animationDrawable",
true, true,
function (timestamp) { function (timestamp) {
let frametime = timestamp - now let frametime = timestamp - now
now = timestamp; now = timestamp;
if (!imageList || imageList.length == 0) return; if (!imageList || imageList.length == 0) return;
if (start === 0) start = now if (start === 0) start = now
if (timestamp - now > 1000 / 60) {
now = timestamp; now = timestamp;
let farme = Math.floor((now - start) / (1000 / 60))
if (farme > allFarme) {
core.unregisterAnimationFrame("animationDrawable");
core.doAction();
return
}
if (core.domStyle.isVertical) { if (core.domStyle.isVertical) {
over.width = 1248; over.width = 1248;
over.height = 2028; over.height = 2028;
@ -19619,7 +19620,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
over.width = 2028; over.width = 2028;
over.height = 1248; over.height = 1248;
} }
farme = Math.floor((now - start) / (1000 / 60))
core.clearMap(ctx) core.clearMap(ctx)
ctx.globalAlpha = (globalAlpha ?? 100) / 100; ctx.globalAlpha = (globalAlpha ?? 100) / 100;
core.fillRect(ctx, 0, 0, 2028, 1248, color); core.fillRect(ctx, 0, 0, 2028, 1248, color);
@ -19689,7 +19690,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
one.sound && one.sound &&
core.sounds[one.sound] && core.sounds[one.sound] &&
core.musicStatus.soundStatus; core.musicStatus.soundStatus;
if (farme == one.startfarme && lisen) { if (farme >= one.startfarme && lisen && !one.start) {
one.start = true
if (one.stopbefore) core.stopSound(); if (one.stopbefore) core.stopSound();
core.playSound(one.sound); core.playSound(one.sound);
} }
@ -19697,12 +19699,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
ctx.restore(); ctx.restore();
if (farme > allFarme) {
core.unregisterAnimationFrame("animationDrawable");
core.doAction();
}
}
} }
); );
}; };