将 canvas 分成几份
Divide canvas to pieces
我正在使用 html2canvas 生成 url 的屏幕截图。此屏幕截图显示在页面上,我希望在单击时能够将其分解。
我从 html2canvas 获得的输出文件是一个 canvas 元素。
我怎样才能"break"把它随机碎片化?我是否应该为我想要的每个片段创建新的 canvas 元素?
Html2Canvas 没有点击。它只是渲染提供给 it.So 的 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,然后您将获得要求的结果。
我正在使用 html2canvas 生成 url 的屏幕截图。此屏幕截图显示在页面上,我希望在单击时能够将其分解。
我从 html2canvas 获得的输出文件是一个 canvas 元素。 我怎样才能"break"把它随机碎片化?我是否应该为我想要的每个片段创建新的 canvas 元素?
Html2Canvas 没有点击。它只是渲染提供给 it.So 的 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,然后您将获得要求的结果。