2012年5月9日 星期三

JForthBlocks--套用Rapheal.js的click事件處理與旋轉圖形Demo

Jimmy's papa這幾天學習如何以JForthBlocks,重寫Rapheal.jsclick事件處理與旋轉圖形Demo,拉拉積木其實不難,但是難在怎麼安排堆疊,讓積木可以適時地吃到它要的參數,完成這個Demo也幫JForthBlocks多了好幾塊有用的積木

以下是JForthBlocks產生的Forth程式碼
準備畫紙 dup dup s" 魒" swap s" https://lh3.googleusercontent.com/-UiOgia1EylQ/T6Omt-ZQg4I/AAAAAAAABSQ/GEh3nev6tS0/s435/Screenshot-10.png" 160 120 320 240 貼圖 swap s" 魒" swap 320 240 200 畫圓 s" a={fill: '#000', 'fill-opacity': .5, 'stroke-width': 5}" javaScript 設圖形屬性 swap over over dup 產生群組 s" 魒" swap rot dup dup s" 魒" swap 24.833 26.917 26.667 畫圓 dup s" a={stroke: '#ccc', fill: '#fff', 'fill-opacity': .4, 'stroke-width': 2}" javaScript 設圖形屬性 rot rot s" 魒" swap s" M12.582,9.551C3.251,16.237,0.921,29.021,7.08,38.564l-2.36,1.689l4.893,2.262l4.893,2.262l-0.568-5.36l-0.567-5.359l-2.365,1.694c-4.657-7.375-2.83-17.185,4.352-22.33c7.451-5.338,17.817-3.625,23.156,3.824c5.337,7.449,3.625,17.813-3.821,23.152l2.857,3.988c9.617-6.893,11.827-20.277,4.935-29.896C35.591,4.87,22.204,2.658,12.582,9.551z" 畫線 dup s" a={stroke: 'none', fill: '#000'}" javaScript 設圖形屬性 swap s" 魒" swap 24.833 26.917 26.667 畫圓 dup s" a={fill: '#fff', opacity: 0}" javaScript 設圖形屬性 同一群組 20 150 平移 1 jsArrayItem value butt1[2] over value img 30 value angle : 旋轉 s" 魒" img s" 魒" s" transform" angle -30 + to angle angle s" r" swap strconcat s" ,320,240" strconcat jsNewObj 1000 s" <>" 動作特效 drop selfid ; 旋轉 butt1[2] swap setEventHandler click 往最前移 .s
這是Jimmy's papa第一次拉了那麼多積木,完成後頭昏腦脹,不知道是否動用到平常不用的95%腦細胞的關係,呵呵!!!
寄件者 scratchlab02
寄件者 scratchlab02
按按箭頭,便能轉轉圖
寄件者 scratchlab02

沒有留言:

張貼留言