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.
我需要使用 vml/canvas/svg 以 3D 显示文本,并对文本的形状进行一些转换,例如 Ctrl+T 在 photoshop 中的效果,甚至将一行文本与曲线对齐。例如,将普通文本转换为旋转的梯形/四边形。
那么,有没有办法先将文本转换为形状?
唯一接近的是getImageData()在Firefox中,这并不理想但还可以。有更好的方法吗?
getImageData()
使用特定于浏览器的 hack 或 voodoo 是可以的,但请不要使用 Flash :)
您可以使用 SVG 中的倾斜变换来进行简单的等距投影。HTML5 画布也是如此。如果您想要其他类型的透视投影,也有一些方法可以做到这一点,例如结合剪切的多重变换,或使用 SVG 过滤器(参见 Hans Schmucker 的一些示例)。
在许多 stackoverflow 帖子之后,我认为最好的解决方案是使用 inkscape。
所以 Javascript 或 HTML5 或 canvas 或 SVG 不能做到这一点。