欣賞任何幫助,想出一個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。看看它。 –