gpt4 book ai didi

algorithm - 随机生成那些Shapes

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:46:13 25 4
gpt4 key购买 nike

我正在寻找一种方法来绘制/生成您可以在 AS3/Haxe (OpenFL) 中在下图中看到的那些形状。可能没有任何外部图像。

Screenshot from this Video: www.youtube.com/watch?v=4_aOIA-vyBo

Image Source

这是我目前得到的:Version 2 ( Source )

最佳答案

看起来这些形状是由具有不同长度的圆边的矩形组成的。

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Graphics.html#drawRoundRect()

获取方法如下:

var rect:Shape = new Shape();
rect.graphics.lineStyle(5, 0x00ff00, 1); //Last arg is the alpha
rect.graphics.beginFill(0xff0000, 1); //Last arg is the alpha
rect.graphics.drawRoundRect(0, 0, 100, 100, 25, 25)
rect.graphics.endFill();
addChild(rect);

您需要随机化 x, y。你可以从 n+-10 左右的 x 和 n+5 左右的 y 中得到一个随机数。

然后对长度和高度做类似的事情。

创建大约 5 个这样的圆角矩形,看看你是怎么做的。

如果您尝试类似的操作并发布结果,我们可以在下一步将它们连接起来。

关于algorithm - 随机生成那些Shapes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23351769/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com