I'm using html2canvas library to take a screenshot of a HTML Node, but it simply doesnt recognize the clip-path
property.
(i'm getting cross-origin issue trying to replicate the error here, so i made a jsfiddle)
https://jsfiddle.net/1Ly9wn6k/
<div id="root">
<div class="star-mask">
<div class="square"></div>
</div>
</div>
<button onclick="capture()">Capture</button>
.star-mask {
clip-path: path('m55,237 74-228 74,228L9,96h240');
}
.square {
background-color: red;
width: 200px;
height: 150px
}
function capture() {
let node = document.querySelector('.star-mask')
html2canvas(node)
.then(canvas => {
document.querySelector('#root').appendChild(canvas)
})
}
Every time i click on "Capture" the canvas screenshot completely ignores the clip-path
of the star shape and display only the red square. I already tried html2image library and got the same issue.
There is some other solution that can solve this issue? Or is currently impossible to capture the clip-path
property using JavaScript?
from How to take a screenshot of HTML Node with clip-path CSS property? (html2canvas not working for this)
No comments:
Post a Comment