scratch 扩展

scratch 扩展

ID:36035460

大小:165.68 KB

页数:7页

时间:2019-04-29

scratch 扩展_第1页
scratch 扩展_第2页
scratch 扩展_第3页
scratch 扩展_第4页
scratch 扩展_第5页
资源描述:

《scratch 扩展》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、CreatingScratch2.0Extensions进行Scratch2.0扩展JohnMaloney约翰·马拉纳MITMediaLaboratory麻省多媒体实验室September,20132013年9月NOTE1:Thisspecificationsupersedesallearlierdrafts.注解1:这份说明书取代了所有早期版本NOTE2:Thisspecificationisstillpreliminaryandmaychange.注解2:这份说明书仍然是初稿并且会被修改Introduction介绍Scratch2.0ca

2、nbeextendedtocontrolexternaldevices(e.g.roboticskits,musicalinstruments)andtoaccessdatafromexternalsensorhardware(e.g.sensorboards).AScratch2.0extensionextendsScratchwithacollectionofcommandandreporterblocksthatcanbeusedtointeractwithaparticulardevice.Whenanextensionisenabl

3、ed,itsblocksappearinthe"MoreBlocks"palette.Scratch2.0可以被扩展到外部设备(例如:机器配件,乐器),也可以获取来自外部硬件传感器(例如:传感器板)的数据。Scratch2.0扩展模块通过命令收集和记录组块,使Scratch可以被用于和特殊设备进行互动。当扩展启动时,它的扩展组块在”MoreBlocks”控制面板显示。Duetobrowsersecurityrestrictions,Scratch2.0cannotinteractwithhardwaredevicesdirectly.Inst

4、ead,hardwareextensionscomewithahelperapp,aseparateapplicationthattheusermustinstallandrunontheircomputer.ScratchcommunicateswiththehelperappviaHTTPrequests,andthehelperapptalkstothehardware.Inthefuture,someextensionsmaypackagetheirhelperappsasbrowserplugins,butthatmechanism

5、isnotdescribedhere.由于浏览器安全限制,Scratch2.0不能和硬件设备直接互动。而是通过一个用户必须安装和运行在电脑上的独立应用程序实现对硬件的扩展。Scratch通过HTTP请求与帮助程序交流,而帮助程序则和硬件通信。未来,一些拓展会把帮助程序打包成浏览器插件,但原理不在此描述。ThisdocumentisaimedatScratch2.0extensiondevelopers.Itdescribestheextensiondescriptionfileformat,theprotocolusedtocommunica

6、tebetweenScratchextensionhelperapps,andtheextensiondevelopmentprocess.这个文档主要为Scratch2.0扩展研发者服务。这里描述了扩展开发过程的文件格式,曾经用于连接Scratch扩展辅助程序和扩展开发过程的协议。Extensiondescriptionfile扩展描述文件AnextensiondescriptionfileisatextfileinJSONformat(www.json.org)thatdescribestheextension.Byconvention,

7、aScratch2.0extensionfileendsin.s2e.TheJSONobjectintheextensiondescriptionfileincludestheextension'sname,theTCP/IPportNumberusedtocommunicatewiththeextensionshelperapp,andalistofScratchblockspecifications.Hereisanexample:一个扩展描述文件是一个JSON格式的文本文件,用以描述扩展。通常,Scratch2.0扩展文件是以“.s2e

8、”作为文件扩展名的。在扩展描述文件中,一个JSON实例包含扩展的名字,用来和辅助应用程序通信的TCP/IP端口号码和一组组件清单。下面是一个例子。{"extensi

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。