I am up for the challenge. I will draw a round bezel with color gradients using about 30 lines of code. I am sure guys like
(yes I am challenging you Tony), could probably do it in fewer lines and before I wake up tomorrow morning.
EDIT: I did a bit of experimenting with adding some extra code to try and get the feel for Night vision. The four corners show white, black. red and blue.
The overlay is a few shades of night vision green. You might want to add more or change those colors.
The opacity changes every 30 seconds so the whole cycle takes about 5 minutes. You should see the print statements indicate what color and what opacity is done.
Code: Select all
base_canvas = canvas_add(0,0,500,500, function()
_rect(0,0,500,500)
_fill("#37474f")
_rect(20,20,50,50)
_fill("white")
_rect(430,20,50,50)
_fill("black")
_rect(20,430,50,50)
_fill("red")
_rect(430,430,50,50)
_fill("blue")
end)
color_palate_canvas= canvas_add(0,0,500,500)
night_vision_canvas = canvas_add(0,0,500,500)
--Create a Hex Table to provide (33x33x33) color palate
ht={"ff","f8","f0","e8","e0","d8","d0","c8","c0","b8","b0","a8","a0","98","90","88","80","78","70","68","60","58","50","48","40","38","30","28","20","18","10","08","00"}
night_table={"#010C01","#012301","#083205","#2E7901","#439413","#66BF2F"}
i3=1
a=1
function disco(count)
i3=i3+a
i3 = var_cap(i3,1,33)
canvas_draw(color_palate_canvas, function()
for i1=1,33 do
for i2 = 1,33 do
_rect(65+(i1*10),65+(i2*10),10,10)
_fill("#"..ht[i1]..ht[i2]..ht[i3])
end
end
end)
if i3 == 33 then a = -1 end
if i3 == 1 then a = 1 end
rotate( color_palate_canvas, 0, "LOG", 0.02)
rotate( color_palate_canvas,32.75*i3)
end
timer_start(0,200,disco)
nc=0
b=1
function night_vision(count)
if nc == 6 then b = -1 end
if nc == 1 then b = 1 end
nc=nc + b
-- nc = var_cap(nc,1,6)
canvas_draw(night_vision_canvas, function()
_rect(0,0,500,500)
_fill(night_table[nc])
_txt("Opacity is at "..c*0.1,"font:arimo_bold.ttf; size:14; color: yellow; halign:center; valign:center;",350,20)
_txt("Color is "..night_table[nc],"font:arimo_bold.ttf; size:14; color: yellow; halign:center; valign:center;",150,20)
end)
print(night_table[nc])
end
timer_start(0,2500,night_vision)
c=0
d=1
function night_vision(count)
c=c + d
c = var_cap(c,1,10)
opacity(night_vision_canvas,c*0.1)
if c == 10 then d = -1 end
if c == 1 then d = 1 end
print("Opacity "..c*0.1)
end
timer_start(0,30000,night_vision)