scratch-vm作用:使用虚拟io屏蔽底层差异,使用render屏蔽ui差异,使软件可以跨端 命名规则:静止状态的标签叫做target(包含stage和sprite),运行状态的标签叫做thread.舞台叫playgroud,渲染/停止渲染叫做grow/ungrow,监视器叫monitor(每个target可以有一个),backpack是背包,workspace是舞台上block的合集,runtime是内核.editing...
Scratch-VM是一个实现Scratch-blocks的动画库,它集成了前文源码分析中的Scratch-Blocks、Scratch-i10l、Scratch-Svg-Renderer、Scratch-Render、Scratch-Storage、Scratch-Audio等库,本系列将会对Scratch-VM的源码进行逐一分析,剖析Scratch3运行环境。 playground例子 Scratch3大项目下的每一个子项目都有一个例子playground,...
npm install scratch-vm To set up a development environment to edit scratch-vm yourself: git clone https://github.com/scratchfoundation/scratch-vm.gitcdscratch-vm npm install Development Server This requires Node.js to be installed. For convenience, we've included a development server with the ...
步入Scratch-VM的使用旅程,首先要做的是初始化环境,定义一系列丰富的外部库。紧接着,通过事件绑定和监听,将Blockly与VM紧密结合,最终搭建出一个流畅运行、功能强大的动画创作平台。
A barebones Scratch project example scratch scratch-blocks scratch-vm Updated Aug 21, 2023 TypeScript Improve this page Add a description, image, and links to the scratch-vm topic page so that developers can more easily learn about it. Curate this topic Add this topic to your repo ...
Scratch VM原理 1. 将积木块转换成JavaScript函数执行。 1. 每个积木块都有一个opcode,对应一个JavaScript函数 2. 状态转移方程:全局变量存储。 3. 每秒钟刷新30次,相当于33毫秒:执行一次状态计算,并重绘整个舞台。 4. 模拟多线程。
Virtual Machine used to represent, run, and maintain the state of programs for Scratch 3.0 - scratch-vm/renovate.json5 at v4.5.470 · scratchfoundation/scratch-vm
attachStorage: 关联存储管理器, gui项目中(reducers/vm.js)调用 setLocale:多语言支持 setEditingTarget shareBlocksToTarget: 当从一个sprite拖拽到另一个sprite时调用 refreshWorkspace: 强制刷新 getTargetIdForDrawableId: 通过renderer的drawableid,反向获取targetid ...
scratch 连接 block和vm 并运行 cd scratch-vm npm install npm link npm run watch cd ../scratch-blocks npm install npm link cd ../scratch-gui npm install npm link scratch-vm scratch-blocks npm start http://localhost:8601
scratch-vm中实现了一套简单巧妙的“线程间”通信机制,帮助管理多个service,并承担service和caller的消息通信。CentralDispatch运行在主线程中,WorkerDispatch运行在Worker中。 CentralDispatch(全局唯一单例) 作为service center,通过service的主动注册(setService(service))保存&管理多个service。