是否可以“翻转”画布图画?还有其他解决方法吗?
我有一组 元素,我正在使用 对其进行“翻转”翻转!。我的问题是,翻转的工作方式是翻转整个
元素,并且在翻转时会产生不太漂亮的效果......所以我想要完成的是“翻转”,方式与翻转类似!确实如此,但在画布内。或者还有其他已知的解决方法吗?
这是我想做的一个小例子: http://jsfiddle.net/hnqB6/4/< /a>.
我想翻转黑色三角形,但是当我使用上面 URL 中的翻转方法时,它会翻转整个画布元素,从而产生不太好的效果。
我很确定您可以在一秒钟内翻转画布中的整个图像,但我正在寻找的也是整个动画。以前有人遇到过这个问题吗?
I've got a set of <canvas>
elements that I am "flipping" around using flip!. My problem is that the way flip works it's flipping the whole <canvas>
element and that's creating a not-so-pretty effect while it's flipping... So what I am trying to accomplish is to "flip" in a similar way as flip! does, but within canvas. Or are there any other known workarounds?
Here's a little example of what I'm trying to do: http://jsfiddle.net/hnqB6/4/.
I would like to flip the black triangles but when I use the flip method from the URL above it flips the whole canvas element which creates the not-so-nice effect.
I'm pretty sure you can just flip the whole image in canvas in a second but what I'm looking for is the whole animation too. Anyone had this problem before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 CSS 3d 变换和过渡在画布元素上执行卡片翻转动画< /a>.仅翻转画布元素的一部分只能通过从头开始编程动画来实现,因为这将包括逐像素地操作位图图像。或者,您可以转换画布矩阵本身,但涉及的工作量比与动画相关的 3D 转换要多得多。
you could use CSS 3d Transforms and Transitions to perform a card flipping animation on the canvas element. flipping only a partial of the canvas element is only possible by programming the animation from scratch, since that would include manipulating the bitmap image pixel by pixel. Alternatively, you could transform the canvases matrix itself, but involves far more work then 3d Transition in relation to the Animation.