欣赏任何帮助,想出一个Livecode脚本块来绘制和填充一组等边三角形。在Livecode中绘制,填充和分组三角形的脚本?
我正在开发一款开源应用程序,可帮助人们用分形模式创建和分享故事。
一个主要挑战是绘制三角形,将表示一个故事的下列元素:
- 吸引
- 挑战
- 机会(状态改变来解决张力)
- 策略
- 测试
- 决定
以上六个标准故事元素中的每一个都将在应用程序中显示为等边三角形。反过来,每个元素都将与独特的颜色相关联 - 黄色,红色,橙色,紫色,蓝色或绿色。
我很想用一个Livecode脚本来绘制六个相合的三角形 - 非常像馅饼切片 - 形成代表整个叙述的六边形。
每个彩色片段的透明度(混合水平)将指示故事的作者或被邀请的评论者认为故事元素完整的程度。
我的希望是拿出在Livecode一个脚本,将:
迅速地将6个三角形,形成六边形
填充每个三角形,其相关联的颜色(每种颜色会具有几乎透明的90%的初始混合水平)
基于其填充颜色的名称为六个三角形中的每一个分配唯一短名称
将这六个三角形分组,以便它们可以一起拖到屏幕上的新位置。
是否有任何脚本(或块)可以帮助解决这个问题?深深感谢任何示例代码或链接,以帮助缩短我的Livecode学习曲线。
最佳,
马克·弗雷泽
======最新进展! ====== [8月2日,6点东部]
我刚刚发现和改编大学劳埃德Rieber多边形生成脚本。格鲁吉亚创造六边形。有没有办法调整它,以便它可以创建一个等边三角形,然后可以复制并旋转以填充六边形?
on mouseUp
global tpoints
if exists(grc "HexagonCanvas" of this card) then delete grc "HexagonCanvas"
lock screen
create grc "HexagonCanvas"
set the loc of grc "HexagonCanvas" to "140,140"
set the opaque of grc "HexagonCanvas" to true
-- resize the new grc
get the rect of grc "HexagonCanvas"
add 80 to item 4 of it
set the rect of grc "HexagonCanvas" to it
put the topleft of grc "HexagonCanvas" into TL
put the topright of grc "HexagonCanvas" into TR
put the bottomleft of grc "HexagonCanvas" into BL
put the bottomright of grc "HexagonCanvas" into BR
put the width of grc "HexagonCanvas" into twidth
put the height of grc "HexagonCanvas" into theight
put trunc(twidth/4) into twidthquart
put trunc(theight/2) into theighthalf
#=========set the points for the "free" hexagon polygon==================
put empty into tpoints
put (item 1 of TL + twidthquart, item 2 of TL) into tpoints
# for the first line of tpoints "put into"
put Cr& (item 1 of TL, item 2 of TL + theighthalf) after tpoints
put CR& (item 1 of BL + twidthquart, item 2 of BL) after tpoints
put CR& (item 1 of BR - twidthquart, item 2 of BR) after tpoints
put Cr& (item 1 of BR, item 2 of BR - theighthalf) after tpoints
put CR& (item 1 of TR - twidthquart, item 2 of TR) after tpoints
put CR& (item 1 of TL + twidthquart, item 2 of TL) after tpoints
set the points of grc "HexagonCanvas" to tpoints
set the style of grc "HexagonCanvas" to "polygon"
set the backgroundColor of grc "HexagonCanvas" to blue
set the blendlevel of grc "HexagonCanvas" to "60"
choose browse tool
end mouseUp
我已经添加了下面的代码绘制6个triagles。看看它。 –