Flash AS3 中的扭曲效果
我正在寻找类似 Photoshop 的扭曲效果,其中图像不旋转,但假设顶部的两个点(角)发生了移动,有人知道如何做到这一点吗?
或者一个想法如何将这两个点向左移动而不用倾斜移动整个图像,我正在使用的当前代码
function skewer(target:DisplayObject, _x:Number, _y:Number):void {
var mtx:Matrix = new Matrix();
mtx.b = _y * Math.PI/180;
mtx.c = _x * Math.PI/180;
mtx.concat(target.transform.matrix);
target.transform.matrix = mtx;
}
尝试了谷歌搜索,图像是用加载器加载的。
谢谢, S
I am looking for photoshop like warp effect, where an image is not rotated, but lets say the top two points(corners) are shifted, anyone would have any idea how to do that?
or an idea how to shift those two points to the left without moving whole image with skew, current code i'm using
function skewer(target:DisplayObject, _x:Number, _y:Number):void {
var mtx:Matrix = new Matrix();
mtx.b = _y * Math.PI/180;
mtx.c = _x * Math.PI/180;
mtx.concat(target.transform.matrix);
target.transform.matrix = mtx;
}
Tried googling a fair bit, the image is loaded in with a loader.
Thanks,
S
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
flashandmath.com 上有一个关于实现这种效果的很棒的教程(带有源代码)。
http://www.flashandmath.com/advanced/p10triangles/method.html
它给出的效果有点像这样:
我的博客上也有不同类型的扭曲效果。我喜欢称之为“马桶效应”:-)
http:// Plasticsturgeon.com/2011 /03/cool-warp-transition-effect-for-text-or-images/
它获取图像并应用两个 Pixelbender 着色器来应用波纹效果和旋转效果。还提供了完整的源代码。
There is a great tutorial (with source code) on achieving that effect on flashandmath.com.
http://www.flashandmath.com/advanced/p10triangles/method.html
It gives an effect a bit like this:
I also have a different type of warp effect on my blog. I like to call it the "toilet bowl" effect :-)
http://plasticsturgeon.com/2011/03/cool-warp-transition-effect-for-text-or-images/
It takes an image and applies two pixelbender shaders to apply a ripple effect and a twirl. Full source code is also provided.
您可以尝试使用(或创建您自己的)Pixel Bender 着色器。 这只是我通过谷歌搜索“像素弯曲变形”。这根本不是您正在寻找的东西,但我想向您展示什么是可能的 - 假设您还不知道。像素弯曲器着色器只是过滤器,不需要动画。
更多信息请参见:使用 Pixel Bender 着色器
you could try using (or creating your own) Pixel Bender shader. this is just a quick example i found by googling "pixel bender warp". it's not at all what you are looking for, but i wanted to show you what's possible - assuming you didn't already know. pixel bender shaders are just filters and do no require animation.
more here: Working with Pixel Bender shaders