niklasvh / html2canvas

Screenshots with JavaScript
https://html2canvas.hertzen.com/
MIT License
30.47k stars 4.8k forks source link

CSS clip-path, perspective & transform: perspective unsupported #3152

Open vayurobins opened 7 months ago

vayurobins commented 7 months ago

Hi. I have an image I want need to look 3d'ish or kinda skewed. I have managed to get it perfectly with styles, but html2canvas cannot reproduce it. It seems that html2canvas does not support the following css styles:

clip-path perspective transform: perspective

html2canvas version: ^1.4.1. Safari: 17.2.1 Chrome: 1.62.165 Firefox: 123.0.1 MacOS Sonoma 14.2.1.

This is the style I am using, that fails for html2canvas: .image-container { clip-path: polygon(0% 18.5%, 98% 0%, 99% 97%, 2% 83%); perspective: 1000px; } .image{ transform: perspective(1000px) translate(-4%) scale(0.7) rotateY(-36deg) rotateX(-2deg) rotateZ(0deg); }