Whats the problem? When I run this, instead of getting the name of the color I just don’t get it. Yes again sorry for this really noobish problem. I’m sure the answer is right in front of face but I can’t figure it out
--main class
function setup()
displayMode(FULLSCREEN)
tx = WIDTH/2 --> this sets the x to halfway
ty = HEIGHT/2 --> this sets the y to halfway
c = color(255,255,0,255)
end
function draw()
background(105, 151, 189, 255)
fill(c) --> c is the colour we defined earlier
ellipse(tx,ty,100)
strokeWidth(5)
textSize(1029)
fontSize(75)
font("SnellRoundhand-Black")
textWrapWidth(846)
roundRect(62,467,200,100,50)
cy = "yello"
colname(cy)
end
function colname(col)
text("the colour is " .. col, WIDTH/2, 800)
end
function touched(touch)
if touch.state == BEGAN then
tx = touch.x
ty = touch.y
c = color(255, 249, 0, 255)
cy = "yellow"
end
if touch.state == MOVING then
tx = touch.x
ty = touch.y
c = color(40, 212, 55, 255)
cy = "green"
end
if touch.state == ENDED then
tx = touch.x
ty = touch.y
c = color(245, 3, 3, 255)
cy = "red"
end
end
--roundRect class stolen from soundPlus
function roundRect(x,y,w,h,r)
pushStyle()
insetPos = vec2(x+r,y+r)
insetSize = vec2(w-2*r,h-2*r)
--Copy fill into stroke
local red,green,blue,a = fill()
stroke(red,green,blue,a)
noSmooth()
rectMode(CORNER)
rect(insetPos.x,insetPos.y,insetSize.x,insetSize.y)
if r > 0 then
smooth()
lineCapMode(ROUND)
strokeWidth(r*2)
line(insetPos.x, insetPos.y,
insetPos.x + insetSize.x, insetPos.y)
line(insetPos.x, insetPos.y,
insetPos.x, insetPos.y + insetSize.y)
line(insetPos.x, insetPos.y + insetSize.y,
insetPos.x + insetSize.x, insetPos.y + insetSize.y)
line(insetPos.x + insetSize.x, insetPos.y,
insetPos.x + insetSize.x, insetPos.y + insetSize.y)
end
popStyle()
end