寻找菜单项所对应的SpecialX触发器

本文介绍了一种方法,通过使用CustomCode中的ShowCustomEvents功能,帮助开发者快速定位Form中菜单项对应的SpecialXTrigger,提高开发效率。

拿到一个陌生的Form,想知道某个菜单项到底在Form中对应的是哪个SpecialX Trigger,可以使用这个方法。

打开Custom Code中的Show Custom Events


 

然后点相应的菜单项就可以知道这个菜单项到底是哪个SpecialX Trigger了。



 

'use strict' export var scriptProperties = createScriptProperties() .addSlider({ name: 'fadeDuration', label: 'Fade Duration', value: 2, min: 1, max: 10, integer: true }) .addSlider({ name: 'imageDuration', label: 'Image Duration', value: 2, min: 2, max: 25, integer: true }) .addText({ name: 'normalImage', label: 'Normal Image Prefix', value: 'image' }) .addText({ name: 'specialImage', label: 'Special Image Prefix', value: 'special' }) .addText({ name: 'effectPrefix', label: 'Effect Prefix (Optional)', value: 'effect' }) .addCheckbox({ name: 'showInSpecial', label: 'Apply effects to special images?', value: false }) .addText({ name: 'musicPrefix', label: 'Music Prefix (Optional)', value: 'music' }) .addCheckbox({ name: 'syncMusic', label: 'Use synchronized music?', value: false }) .finish() /** @type {ILayer[]} */ const normalImages = [] /** @type {ILayer[]} */ const effectLayers = [] let fadeDuration let imageDuration let totalDurationPerImage /** @type {ILayer} */ let specialMusic /** @type {ILayer} */ let normalMusic let volumes = {} let elapsedTime = 0 let firstCicle = false let useMusic = false let prevToggle export function init(_) { const totalLayers = thisScene.enumerateLayers() const normalLayers = totalLayers.filter(e => e.name.includes(`${scriptProperties['normalImage']}`)) const effLayers = totalLayers.filter(e => e.name.includes(`${scriptProperties['effectPrefix']}`)) const musicLayer = totalLayers.filter(e => e.name.includes(`${scriptProperties['musicPrefix']}`)) // If the first image is special and showInSpecial is TRUE, then prevToggle is TRUE // If the first image is special and showInSpecial is FALSE, then prevToggle is FALSE // If the first image is normal and showInSpecial is TRUE, then prevToggle is FALSE // If the first image is normal and showInSpecial is FALSE, then prevToggle is TRUE const isSpecialImage = thisScene.getLayer(0).name.includes(`${scriptProperties['specialImage']}`) const showInSpecial = scriptProperties['showInSpecial'] // This covers the first cases if (isSpecialImage) { prevToggle = showInSpecial } else { // this covers the others prevToggle = !showInSpecial } // Collect effects for (const special of effLayers) { console.log(`🎥 "${special.name}" effect registered`) special.instance.alpha = prevToggle === true ? 1 : 0 effectLayers.push(special) } // Collect images for (const img of normalLayers){ if (img.name.includes(scriptProperties['specialImage'])) console.log(`📸"${img.name}" special image registered`) else console.log(`📷 "${img.name}" image registered`) // Animation is not applied for the first image in the first cycle. if (img !== thisScene.getLayer(0)) { img.alpha = 0 img.visible = true } normalImages.push(img) } if (musicLayer.length < 1) return else useMusic = true for (const music of musicLayer){ if (scriptProperties['syncMusic']) music.playbackmode = 'single' if (music.name.includes(`${scriptProperties['specialImage']}`)){ console.log(`🎶 "${music.name}" special music registered`) specialMusic = music } else { console.log(`🎶 "${music.name}" music registered`) normalMusic = music } volumes[music.name] = music.volume } specialMusic.play() normalMusic.play() if (prevToggle){ normalMusic.volume = 0 } else { specialMusic.volume = 0 } } function toggleEffects (value) { const progressInCurrentImage = elapsedTime % totalDurationPerImage const duration = (fadeDuration - (fadeDuration * .30)) if (prevToggle === value || progressInCurrentImage >= duration) return for (const effect of effectLayers){ if (!value){ effect.instance.alpha = 1 - (progressInCurrentImage / duration) } else { effect.instance.alpha = progressInCurrentImage / duration } } } function toggleMusic (value) { if (!useMusic) return const progressInCurrentImage = elapsedTime % totalDurationPerImage const duration = (fadeDuration - (fadeDuration * .30)) if (prevToggle === value || progressInCurrentImage >= duration) return if (!value){ specialMusic.volume = volumes[specialMusic.name] * ((duration - progressInCurrentImage )/ duration) normalMusic.volume = (progressInCurrentImage / duration) * volumes[normalMusic.name] } else { normalMusic.volume = volumes[normalMusic.name] * ((duration - progressInCurrentImage )/ duration) specialMusic.volume = (progressInCurrentImage / duration) * volumes[specialMusic.name] } } export function update(_) { fadeDuration = engine.userProperties['fadeduration'] ?? scriptProperties['fadeDuration'] imageDuration = engine.userProperties['imageduration'] ?? scriptProperties['imageDuration'] totalDurationPerImage = fadeDuration * 2 + imageDuration let idx = Math.floor(elapsedTime / totalDurationPerImage) % normalImages.length const prevIdx = idx === 0 ? normalImages.length - 1 : idx - 1 const progressInCurrentImage = elapsedTime % totalDurationPerImage if (!scriptProperties['syncMusic']) { if (!normalMusic.isPlaying()) normalMusic.play() if (!specialMusic.isPlaying()) specialMusic.play() } else if (!normalMusic.isPlaying() && !specialMusic.isPlaying()) { normalMusic.play() specialMusic.play() } // Manage images loop, only with 3 or more images if (normalImages.length > 2) { const nextIdx = (idx + 1) % normalImages.length; thisScene.sortLayer(normalImages[nextIdx], thisScene.getLayerIndex(normalImages[idx]) + 1); } if (idx === 0 && !firstCicle) { elapsedTime += engine.frametime return } if (idx === normalImages.length - 1){ firstCicle = true } if (progressInCurrentImage < fadeDuration){ normalImages[idx].alpha = progressInCurrentImage / fadeDuration // If there are only two images, alternate between them if (normalImages.length === 2) { normalImages[prevIdx].alpha = 1 - (progressInCurrentImage / fadeDuration) } if (normalImages[idx].name.includes(`${scriptProperties['specialImage']}`)){ toggleEffects(scriptProperties['showInSpecial']) toggleMusic(scriptProperties['showInSpecial']) } else { toggleEffects(!scriptProperties['showInSpecial']) toggleMusic(!scriptProperties['showInSpecial']) } } if (progressInCurrentImage >= fadeDuration && progressInCurrentImage < fadeDuration + imageDuration){ normalImages[idx].alpha = 1 normalImages[prevIdx].alpha = 0; if (normalImages[idx].name.includes(`${scriptProperties['specialImage']}`)){ prevToggle = scriptProperties['showInSpecial'] } else { prevToggle = !scriptProperties['showInSpecial'] } } elapsedTime += engine.frametime } 这段代码要如何使用于壁纸引擎内
08-02
内容概要:本文档围绕六自由度机械臂的ANN人工神经网络设计展开,涵盖正向与逆向运动学求解、正向动力学控制,并采用拉格朗日-欧拉法推导逆向动力学方程,所有内容均通过Matlab代码实现。同时结合RRT路径规划与B样条优化技术,提升机械臂运动轨迹的合理性与平滑性。文中还涉及多种先进算法与仿真技术的应用,如状态估计中的UKF、AUKF、EKF等滤波方法,以及PINN、INN、CNN-LSTM等神经网络模型在工程问题中的建模与求解,展示了Matlab在机器人控制、智能算法与系统仿真中的强大能力。; 适合人群:具备一定Ma六自由度机械臂ANN人工神经网络设计:正向逆向运动学求解、正向动力学控制、拉格朗日-欧拉法推导逆向动力学方程(Matlab代码实现)tlab编程基础,从事机器人控制、自动化、智能制造、人工智能等相关领域的科研人员及研究生;熟悉运动学、动力学建模或对神经网络在控制系统中应用感兴趣的工程技术人员。; 使用场景及目标:①实现六自由度机械臂的精确运动学与动力学建模;②利用人工神经网络解决传统解析方法难以处理的非线性控制问题;③结合路径规划与轨迹优化提升机械臂作业效率;④掌握基于Matlab的状态估计、数据融合与智能算法仿真方法; 阅读建议:建议结合提供的Matlab代码进行实践操作,重点理解运动学建模与神经网络控制的设计流程,关注算法实现细节与仿真结果分析,同时参考文中提及的多种优化与估计方法拓展研究思路。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值