Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我一直在努力将我的 html5 画布导出为 .gif 图像,我能够成功地将其保存为 .png 文件。我不知道这里做错了什么是我的简单代码
canvas.onclick = function () { window.location = canvas.toDataURL('image/gif'); };
这将回答你的问题。简而言之,尝试 console.log'ing 你的数据,并不是所有的浏览器都支持写入 gif。
下面的代码应该做到这一点:无论当前的运动员在哪里,当你点击下一个按钮时,下面的代码就会被执行。它应该将当前运动员更改为数组中的下一个运动员,然后当它到达最后一个人时,它需要循环回 0(第一个对象)。它确实做到了这一点。当我到达数组的末尾时,它会再次转到第一个人,这是正确的,但从那时起将跳过数组中的最后