0
我想使用梯形图像反射。那为什么我要求如何创建矩阵类的梯形形状In flex如何创建矩阵类的梯形形状?
我想使用梯形图像反射。那为什么我要求如何创建矩阵类的梯形形状In flex如何创建矩阵类的梯形形状?
对于剪切数学上的原因你不能用Matrix类本身来实现这一点。
但是,只要您正在编译Flash Player 10或更高版本,就可以实现您希望实现的效果,即具有图像或组件反射看起来好像具有3D透视效果。您可以使用Matrix3D类来完成此操作,该类允许您影响Flash中的伪3D转换(投影转换)。
例
在MXML:
<mx:Image id="img" source="@Embed('image.jpg')"/>
<mx:Image id="reflection" source="{img.source}"
creationComplete="reflectImage()"/>
,并在脚本块:
protected function reflectImage():void
{
var m3D:Matrix3D = new Matrix3D();
m3D.appendScale(1,-1,-1); // flip the image
m3D.appendTranslation(0,img.height,0); // move it back to (0,0,0)
m3D.appendRotation(-45, Vector3D.X_AXIS); // rotate it (this gives it the trapezoid shape)
m3D.appendTranslation(0,img.height,0); // move to the bottom of "img"
reflection.transform.matrix3D = m3D;
}
你可能会想用数字玩了一下影响看看你的目标是什么,但这是要走的路。
注意:MXML中的任何转换(如设置x,y)将被reflectImage
函数覆盖。
你能否提供更多关于你想要做什么的描述?主要是,我不明白你为什么需要或想要使用Matrix类。您是否打算使用Matrix来转换其他组件的视图?如果你只想绘制一个梯形,那么可以像图形基元一样完成,例如,扩展FilledElement类并覆盖draw(g:Graphics)方法,就像spark.primitives.Rect类一样。 – merv
我想使用梯形形状的图像反射。那为什么我问如何用矩阵类创建梯形形状。 – Rajkamal
你知道,复制粘贴你刚才所说的内容并不真正有帮助。 –