Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- *
- * p1,p2,p3,p4 should be parts in workspace.
- * run in your studio's console, not ingame.
- * suwacrab 2020:29:06
- --]]
- local function hextoclr(h)
- local r = bit32.rshift(h,16)
- local g = bit32.band(bit32.rshift(h,8),255)
- local b = bit32.band(h,255)
- return Color3.fromRGB(r,g,b)
- end
- local c = {
- hextoclr(0xf8e3c4),
- hextoclr(0xcc3495),
- hextoclr(0x6b1fb1),
- hextoclr(0x0b0630)
- }
- local pnts = {}
- local cf_pnts = {}
- local c3_pnts = {}
- local deb = game:GetService("Debris")
- local function updt_pnts()
- for i = 1,4 do
- pnts[i] = workspace["p"..i]
- cf_pnts[i] = pnts[i].CFrame
- --c3_pnts[i] = c[i]
- c3_pnts[i] = pnts[i].Color
- --pnts[i].Color = c[i]
- end
- end
- local function bez_3(a,b,c,f)
- local l1 = a:lerp(b,f)
- local l2 = b:lerp(c,f)
- return l1:lerp(l2,f)
- end
- local function bez_m(m,f)
- local bt = {}
- for i = 1,#m-2 do
- local a,b,c = m[i],m[i+1],m[i+2]
- bt[#bt+1] = a:lerp(b,f)
- bt[#bt+1] = b:lerp(c,f)
- end
- local l = bt[1]:lerp(bt[2],f)
- if #bt > 2 then
- for i = 3,#bt do
- l = l:lerp(bt[i],f)
- end
- end
- return l
- end
- for t = 0,15*5 do
- updt_pnts()
- for i = 0,255,1 do
- local dt = i/256
- local p = Instance.new("Part")
- p.Size = Vector3.new(1,1,1)*8
- p.Shape = "Ball"
- --p.Material = "Neon"
- p.CFrame = bez_m(cf_pnts,dt)
- p.Color = bez_m(c3_pnts,dt)
- deb:AddItem(p,1/15)
- p.Parent = workspace
- end
- wait()
- end
- -- extra: palette exporting.
- local pal_export = true
- if pal_export then
- local pal_len = 0x100;
- local palstr = {"JASC-PAL\n","0100\n",
- ("%d\n"):format(pal_len)
- }
- for i = 0,pal_len-1 do
- local clr = bez_m(c3_pnts,i/pal_len)
- local r = clr.r*255
- local g = clr.g*255
- local b = clr.b*255
- palstr[#palstr+1] = ("%d %d %d\n"):format(
- math.floor(r),math.floor(g),math.floor(b)
- )
- end
- local nv = Instance.new("StringValue",workspace)
- nv.Name = "palette export"
- nv.Value = table.concat(palstr)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement