github 相关知识

1. 设置链接,预览github静态页面

github htmlpreview 可以直接浏览html, 只要写成这样的链接格式:http://htmlpreview.github.io/?  +  你的github的html地址

如:

http://htmlpreview.github.io/?https://github.com/jdk137/learnThree.js/master/huazhang/chapter-03/01-ambient-light.html

但是其中有个坑要注意,如果代码中有页面加载完的onload函数, 如window.onload = init,  这个函数不会触发。
 

2. 提示图片跨域, 可以通过js加载来绕过。

Failed to execute 'texImage2D' on 'WebGL2RenderingContext': The image element contains cross-origin data, and may not be loaded.

https://github.com/ml5js/ml5-library/issues/217

const img = new Image();
img.crossOrigin = "anonymous";
img.src = url;

老版本的THREE.js, 可以设置  THREE.ImageUtils.crossOrigin = '';

猜你喜欢

转载自blog.csdn.net/jdk137/article/details/88554952