如何从spark.LinearGradient到beginGradientFill
我正在尝试将此 LinearGradient 转换
<s:LinearGradient rotation="90" scaleX="44.2931" x="10.294" y="-0.276" >
<s:GradientEntry color="#FFD500" ratio="0"/>
<s:GradientEntry color="#F5A106" ratio="1"/>
</s:LinearGradient>
为等效的 beginGradientFill 调用。我对翻译的最佳猜测是这样的
var matr:Matrix = new Matrix();
matr.createGradientBox(20, 20, Math.PI/2, 10.294, -0.276);
g.beginGradientFill(GradientType.LINEAR, [0xFFD500, 0xF5A106], [1,1], [0,1], matr);
,但我不确定这是否正确,也不知道盒子的大小应该是多少(上面代码中的两个 20 只是我尝试的东西)。希望任何专家专家的意见!
谢谢你!
I'm trying to translate this LinearGradient
<s:LinearGradient rotation="90" scaleX="44.2931" x="10.294" y="-0.276" >
<s:GradientEntry color="#FFD500" ratio="0"/>
<s:GradientEntry color="#F5A106" ratio="1"/>
</s:LinearGradient>
into an equivalent beginGradientFill call. My best guess of the translation is this
var matr:Matrix = new Matrix();
matr.createGradientBox(20, 20, Math.PI/2, 10.294, -0.276);
g.beginGradientFill(GradientType.LINEAR, [0xFFD500, 0xF5A106], [1,1], [0,1], matr);
but I'm not sure if this is right, nor I know what the size of the box should be (the two 20s in the code above are just me trying stuff). Would love any expert expert opinions!
thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此示例可以说明如何绘制与
s:LinearGradient
中相同的填充:看一下执行所有计算的
getMatrix()
方法。This sample can illustrate how to draw the same fill as in
s:LinearGradient
:Take a look at
getMatrix()
method which performs all the calculations.