在VisualStudio Code中调试html页面(JS,canvas,easeljs)

一、 效果目的

在VSCode里,直接F5打开html页面,并且可以在编辑器里编辑代码

二、 工具准备

安装vs code (在官网下载)
安装nodejs : 输入npm install node
安装canvas:输入npm install canvas
安装easeljs:输入 npm install easeljs
VSCode 上装一个插件:Debugger for Chrome.
在VisualStudio Code中调试html页面(JS,canvas,easeljs)_第1张图片

三、 配置文件更改

  1. 用VSCode装载项目
    在VisualStudio Code中调试html页面(JS,canvas,easeljs)_第2张图片
  2. 然后按F5。选择Chrome。
    在VisualStudio Code中调试html页面(JS,canvas,easeljs)_第3张图片
  3. 然后出现个配置的提示,和打开了launch.json这个文件。在 这个文件里添加一段配置信息
    {
    “name”: “使用本机 Chrome 调试”,
    “type”: “chrome”,
    “request”: “launch”,
    “file”: “ w o r k s p a c e R o o t / i n d e x . h t m l " , / / " u r l " : " h t t p : / / m y s i t e . c o m / i n d e x . h t m l " , / / 使 用 外 部 服 务 器 时 , 请 注 释 掉 f i l e , 改 用 u r l , 并 将 u s e B u i l d I n S e r v e r 设 置 为 f a l s e " h t t p : / / m y s i t e . c o m / i n d e x . h t m l " r u n t i m e E x e c u t a b l e " : " C : P r o g r a m F i l e s ( x 86 ) G o o g l e C h r o m e A p p l i c a t i o n c h r o m e . e x e " , / / 改 成 您 的 C h r o m e 安 装 路 径 " s o u r c e M a p s " : t r u e , " w e b R o o t " : " {workspaceRoot}/index.html", // "url": "http://mysite.com/index.html", //使用外部服务器时,请注释掉 file, 改用 url, 并将 useBuildInServer 设置为 false "http://mysite.com/index.html "runtimeExecutable": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", // 改成您的 Chrome 安装路径 "sourceMaps": true, "webRoot": " workspaceRoot/index.html",//"url":"http://mysite.com/index.html",//使,file,url,useBuildInServerfalse"http://mysite.com/index.html"runtimeExecutable":"C:ProgramFiles(x86)GoogleChromeApplicationchrome.exe",//Chrome"sourceMaps":true,"webRoot":"{workspaceRoot}”,
    // “preLaunchTask”:“build”,
    “userDataDir”:"${tmpdir}",
    “port”:5433
    }
    在VisualStudio Code中调试html页面(JS,canvas,easeljs)_第4张图片
  4. 更改调试方式
    在VisualStudio Code中调试html页面(JS,canvas,easeljs)_第5张图片

四、 .然后 F5。结果如下

在VisualStudio Code中调试html页面(JS,canvas,easeljs)_第6张图片

五、 附html代码(src 要给成你自己的easeljs安装地址)



    动画特效
    


    
    


参考
1.H5动画入门 Easeljs篇(学习笔记)https://www.jianshu.com/p/93e12e9102de
2.使用VSCode 断点调试 js项目,html页面https://blog.csdn.net/arvin0/article/details/53673351

你可能感兴趣的:(JavaScript)