笔记

snode = getnodebyname $.name
snode.transform  节点获取

  fn sphere_r =
  (
  ooh = Sphere radius:8.22422 smooth:on segs:32 pos:[30,0,0]
   ooh.
   intu =20
   for angle in 1 to 360 by intu do
   (
    instance  ooh  rotation:(quat angle Z_axis )
   
    intu+=20
   )---end for
   delete ooh
  )

--招录的相机复制脚本

  • --先选择相机
  • po =$.target.pos
  • Tobj =Targetobject pos:po
  • Cam =copy $
  • Cam.target =Tobj
  • Cam.wirecolor =$.wirecolor
  • nam =Cam.name
  • Tobj.name =nam+".Target"
  • select #(Cam,Tobj)
  • ---渐变算法

    GC()

    FreeSceneBitmaps() ---释放位图内存

    if theCanvas!= undefined do UnDisplay theCanvas --不进行显示。

    CanvasWidth = 512 --设定大小。

    CanvasHeight = 50

    lablepos_array = #(0,0.25,0.5,0.75,1) ---这里就是简便的%

    labelcolor_array = #(green, brown, red, yellow, blue)

    color_array = #()

    theCanvas = bitmap CanvasWidth CanvasHeight color:white ---其实这里的颜色也可以是空 那么缺省就是黑色的啦。

    for i = 1 to lablepos_array.count do if i > 1 do---- 这钟写法看似很帅啊,

    (       ---从第二个开始的。       

            local start_pos = (lablepos_array[i - 1] * (CanvasWidth)) as integer --保证是整数

            local end_pos = ((lablepos_array[i] * CanvasWidth) - 1) as integer --这里就是长度的% 看着像。

            local set_pos = 0.0

            local art_pos = (end_pos - start_pos) as float

            for x = start_pos to end_pos do

            (       --其实设置渐变色的算法来自这里。

                    local start_set = (art_pos - set_pos) / art_pos  ---我觉得这个是往后渐变除

                    local set_color = labelcolor_array[i - 1] * ((start_set * 256.0) / 255.0) + labelcolor_array[i] * (((1.0 - start_set) * 256.0) / 255.0)

                    set_color.a = 255.0 ---这里是通道。

                    append color_array set_color

                    set_pos = set_pos + 1.0

            )

    )

    for y = 0 to CanvasHeight - 1 do SetPixels theCanvas [0, y] color_array

    Display theCanvas

    posted on 2011-03-30 14:44  盖天00  阅读(122)  评论(0编辑  收藏  举报

    导航