@スプリット(位置拡張)
--track0:中心X,-5000,5000,0
--track1:中心Y,-5000,5000,0
--track2:幅,0,5000,200
--track3:回転,-3600,3600,0

  T_split_CX = obj.track0
  T_split_CY = obj.track1
  T_split_W  = obj.track2
  T_split_ROT= math.rad(obj.track3)

@スプリット(形状拡張:ｱﾝｶｰ)
--track0:オフセット,0,100,30
--track1:繰り返し,1,50,1,1
--track2:傾斜,-100,100,0
--track3:ｱﾝｶｰ数,2,16,3,1
--check0:滑らかに,1
--dialog:座標,T_POS={-100,0,0,0,100,0};

  local An=obj.track3
  obj.setanchor("T_POS",An)

  local of=obj.track0*0.01
  local rp=obj.track1
  local a=obj.track2*0.01

  T_line_data={}

  for i=1,An-1 do
  for j=i+1,An do
    if T_POS[2*i-1]>T_POS[2*j-1] then
      T_POS[2*i-1],T_POS[2*j-1]=T_POS[2*j-1],T_POS[2*i-1]
      T_POS[2*i],T_POS[2*j]=T_POS[2*j],T_POS[2*i]
    end
  end
  end
  for i=1,An do
    T_line_data[i]=-T_POS[2*i]
  end

  local Min=math.min(unpack(T_line_data))
  for i=1,#T_line_data do
    T_line_data[i]=T_line_data[i]-Min
  end

  local N=#T_line_data
  for j=2,rp do
    for i=1,N do
      T_line_data[i+(j-1)*N]=T_line_data[i]
    end
  end

  local sfi=(1+#T_line_data)*0.5
  for i=1,#T_line_data do
    T_line_data[i]=T_line_data[i]*(a*(i-sfi)/sfi+1)
  end

  local Max=math.max(unpack(T_line_data))
        Min=math.min(unpack(T_line_data))
  for i=1,#T_line_data do
    T_line_data[i]=(T_line_data[i]-Min)/(Max-Min)*(1-of)+of
  end

  if obj.check0 then
    T_line_data_fl=1
  else
    T_line_data_fl=2
  end

@スプリット(形状拡張:ﾌｧｲﾙ)
--track0:オフセット,0,100,30
--track1:繰り返し,1,50,1,1
--track2:傾斜,-100,100,0
--check0:滑らかに,1
--file:

  local of=obj.track0*0.01
  local rp=obj.track1
  local a=obj.track2*0.01

  T_line_data={}
  local one=io.input(file)
  while (one) do
    one=io.read("*l")
    if (one) then
      table.insert(T_line_data,one)
    end
  end

  local Min=math.min(unpack(T_line_data))
  for i=1,#T_line_data do
    T_line_data[i]=T_line_data[i]-Min
  end

  local N=#T_line_data
  for j=2,rp do
    for i=1,N do
      T_line_data[i+(j-1)*N]=T_line_data[i]
    end
  end

  local sfi=(1+#T_line_data)*0.5
  for i=1,#T_line_data do
    T_line_data[i]=T_line_data[i]*(a*(i-sfi)/sfi+1)
  end

  local Max=math.max(unpack(T_line_data))
        Min=math.min(unpack(T_line_data))
  for i=1,#T_line_data do
    T_line_data[i]=(T_line_data[i]-Min)/(Max-Min)*(1-of)+of
  end

  if obj.check0 then
    T_line_data_fl=1
  else
    T_line_data_fl=2
  end

@スプリット
--track0:ｽﾌﾟﾘｯﾄ1,0,100,30
--track1:ｽﾌﾟﾘｯﾄ2,0,100,30
--track2:形状,0,300,100
--track3:影響範囲,100,1000,100
--dialog:上下を揃える/chk,local spC=0;穴だけ開ける/chk,local hoC=0;横分割数,local spN=30;縦分割数,local spNy=30;位置,pos={-100,0,100,0};透明度境界ボカシ,local bl=1

  local sp1=obj.track0*0.01
  local sp2=obj.track1*0.01
  local fig=obj.track2*0.01
  local maxP=obj.track3*0.01

  if fig>1 then fig=10*fig-9 end

  spN=math.floor(math.abs(spN))
  if spN<2 then spN=2 end
  spNy=-math.floor(-math.abs(spNy/2))
  if spNy<2 then spNy=2 end

  local w,h = obj.getpixel()
  local w2,h2=w*0.5,h*0.5
  local split_CX,split_CY,split_W,split_ROT 

  if T_split_CX==nil then
    obj.setanchor("pos",2,"line")
    local dx=pos[3]-pos[1]
    local dy=pos[4]-pos[2]
    split_CX = (pos[1]+pos[3])/2
    split_CY = (pos[2]+pos[4])/2
    split_W  = math.sqrt(dx*dx+dy*dy)
    split_ROT= math.atan2(dy,dx)
  else
    split_CX = T_split_CX
    split_CY = T_split_CY
    split_W  = T_split_W
    split_ROT= T_split_ROT
  end

--配列の宣言

  local x={}
  local z={}
  local ys1={}
  local ys2={}
  local xs1={}
  local xs2={}
  local us1={}
  local us2={}
  local vs1={}
  local vs2={}

  for i=0,spN do
    xs1[i]={}
    xs2[i]={}
    ys1[i]={}
    ys2[i]={}
    us1[i]={}
    us2[i]={}
    vs1[i]={}
    vs2[i]={}
  end

--基準座標計算

  if T_line_data_fl==1 then
    local Fn=#T_line_data
     for i=0,spN do
      x[i]=(i-spN/2)*2/spN
      local t=(Fn-1)*i/spN+1
      local t1=math.floor(t)
      local t0=t1-1
      local t2=t1+1
      local t3=t1+2
      if t0<1 then t0=1 end
      if t2>Fn then t2=Fn end
      if t3>Fn then t3=Fn end
      z[i]=obj.interpolation(t-t1,T_line_data[t0],T_line_data[t1],T_line_data[t2],T_line_data[t3])
    end
  elseif T_line_data_fl==2 then
     local Fn=#T_line_data
     for i=0,spN do
      x[i]=(i-spN/2)*2/spN
      local t=math.floor((Fn-1)*i/spN+1.5)
      if t>Fn then t=Fn end
      z[i]=T_line_data[t]
    end
  else
     for i=0,spN do
      x[i]=(i-spN/2)*2/spN
      local abx=math.abs(x[i])
      z[i]=(abx-1)*(abx-1)*(3*abx*abx+2*abx+1)
    end
  end

  for i=0,spN do
    local z1=sp1*(z[i]^fig)
    local z2=sp2*(z[i]^fig)

    if spC==1 then z2=z1 end
    z1=-z1

    for j=0,spNy do
      ys1[i][j]=z1*(1-j/spNy)-j/spNy
      ys2[i][j]=z2*(1-j/spNy)+j/spNy
    end --j
  end --i

--表示座標計算
  local split_W2=split_W*0.5
  local split_H2=split_W2*maxP
  local cos=math.cos(split_ROT)
  local sin=math.sin(split_ROT)

  for i=0,spN do

    x[i]=x[i]*split_W2
    for j=0,spNy do

      ys1[i][j]=ys1[i][j]*split_H2
      ys2[i][j]=ys2[i][j]*split_H2

  --回転させて、中心ずらす
      xs1[i][j],ys1[i][j] = cos*x[i]-sin*ys1[i][j]+split_CX , sin*x[i]+cos*ys1[i][j]+split_CY
      xs2[i][j],ys2[i][j] = cos*x[i]-sin*ys2[i][j]+split_CX , sin*x[i]+cos*ys2[i][j]+split_CY
    end --j
  end --i

  if hoC==0 then
    for j=0,spNy do
      local v= split_H2*j/spNy
      for i=0,spN do
        us1[i][j],vs1[i][j] = cos*x[i]+sin*v+split_CX+w2 , sin*x[i]-cos*v+split_CY+h2
        us2[i][j],vs2[i][j] = cos*x[i]-sin*v+split_CX+w2 , sin*x[i]+cos*v+split_CY+h2
      end
    end
  end

--表示
--オリジナルの上に描画、穴あけは、スプリットを回転させた場合のホール対策

  obj.setoption("drawtarget","tempbuffer",w,h)
  obj.draw()

  obj.setoption("antialias",0)
  if hoC==0 then
    for j=0,spNy-1 do
      for i=0,spN-1 do
        local x0,y0=xs1[i  ][j  ],ys1[i  ][j  ]
        local x1,y1=xs1[i+1][j  ],ys1[i+1][j  ]
        local x2,y2=xs1[i+1][j+1],ys1[i+1][j+1]
        local x3,y3=xs1[i  ][j+1],ys1[i  ][j+1]
        local u0,v0=us1[i  ][j  ],vs1[i  ][j  ]
        local u1,v1=us1[i+1][j  ],vs1[i+1][j  ]
        local u2,v2=us1[i+1][j+1],vs1[i+1][j+1]
        local u3,v3=us1[i  ][j+1],vs1[i  ][j+1]
        obj.drawpoly(x0,y0,0,x1,y1,0,x2,y2,0,x3,y3,0 , u0,v0,u1,v1,u2,v2,u3,v3)

        local x0,y0=xs2[i  ][j  ],ys2[i  ][j  ]
        local x1,y1=xs2[i+1][j  ],ys2[i+1][j  ]
        local x2,y2=xs2[i+1][j+1],ys2[i+1][j+1]
        local x3,y3=xs2[i  ][j+1],ys2[i  ][j+1]
        local u0,v0=us2[i  ][j  ],vs2[i  ][j  ]
        local u1,v1=us2[i+1][j  ],vs2[i+1][j  ]
        local u2,v2=us2[i+1][j+1],vs2[i+1][j+1]
        local u3,v3=us2[i  ][j+1],vs2[i  ][j+1]
        obj.drawpoly(x0,y0,0,x1,y1,0,x2,y2,0,x3,y3,0 , u0,v0,u1,v1,u2,v2,u3,v3)
      end --i
    end --j
  end

--穴あけ
  obj.load("figure","四角形",0xffffff,math.max(w,h))
  obj.setoption("antialias",1)
  obj.setoption("blend","alpha_sub")
  for i=0,spN-1 do
      local x0,y0=xs1[i  ][0],ys1[i  ][0]
      local x1,y1=xs1[i+1][0],ys1[i+1][0]
      local x2,y2=xs2[i+1][0],ys2[i+1][0]
      local x3,y3=xs2[i  ][0],ys2[i  ][0]
      obj.drawpoly(x0,y0,0,x1,y1,0,x2,y2,0,x3,y3,0)
  end

  obj.load("tempbuffer")
  obj.effect("境界ぼかし","範囲",bl,"透明度の境界をぼかす",1)
  --obj.setoption("blend",0)
  T_split_CX=nil
  T_split_CY=nil
  T_split_W=nil
  T_split_ROT=nil
  T_line_data_fl=nil