gpt4 book ai didi

javascript - 将 Canvas 分成几 block

转载 作者:行者123 更新时间:2023-11-28 05:31:35 25 4
gpt4 key购买 nike

我正在使用 html2canvas 生成网址的屏幕截图。此屏幕截图显示在页面上,我希望能够在单击它时将其分成几部分。

我从 html2canvas 获得的输出文件是一个 canvas 元素。我怎样才能将它“打破”成随机碎片?我应该为我想要的每件作品创建新的 Canvas 元素吗?

最佳答案

Html2Canvas 未单击 。它只是渲染提供给它的 DOM 元素。所以我认为你不能将渲染的 Canvas 分解成碎片。

How it works

The script traverses through the DOM of the page it is loaded on. It gathers information on all the elements there, which it then uses to build a representation of the page. In other words, it does not actually take a screenshot of the page, but builds a representation of it based on the properties it reads from the DOM.

但是您可以做的一件事是将 DOM 内容分成多个部分,然后您可以对每个 DOM 部分使用 Html2Canvas 并获得所需的结果。

关于javascript - 将 Canvas 分成几 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39654128/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com