Hey guys, I recently came across a game called OLO. Its very simple and something I really like about it is the color transitions they have during the menu. The effect I’m talking about is displayed in the beginning of this video.
I imagine it wouldn’t be that hard to include into Codea because I want to use it in my project as well. I think the code might go something like where you add a value to the RBG every time you call it. For example,
.@Jordan@Kirl I learned how to use your code into my background and now I was just wondering how I could add more colors to the spectrum. I already tried putting a green and blue value but all i get is a fade to black and back. How do I add more colors and still make it look nice, color wise?
thanks .@Zoyt. Since you have created this class, I have one question. My whole game UI is based on pastel colors. I wanna make the color shifting include pastels as well but I can’t full manage to. This is what I have so far:
ChangeColor = class()
function ChangeColor:init(cc,r,g,b)
self.phase = 0
self.changingpace = cc
self.bgr = r
self.bgg = g
self.bgb = b
end
function ChangeColor:update()
self.bgr = 29+ 100 * math.sin(self.phase / (2*math.pi))
self.bgg = 107+ 100 * math.sin(self.phase * 4/ (2*math.pi))
self.bgb = 157+ 100 * math.sin(self.phase * 6/ (2*math.pi))
self.phase = self.phase + self.changingpace
if self.phase > (360 * 6) then
self.phase = 0
end
end
function ChangeColor:getColor()
return self.bgr,self.bgg,self.bgb
end
It’s ok if you don’t know how, as you’ve posted this code a while back, but thank you
If your UI is based on pastels then I assume that you want only pastels in your color shift. What about adding some white to the color before using it?
I’m not sure how to make nice pastel colors, perhaps there is some kind of technical definition of a pastel color? Maybe look into pastel filters of photo editing programs.
Anyway, I would try to reduce the distance to white, i.e. reduce the distance to 255 for each of the color components red, green and blue.
Here’s an example for the red component, you’ll have to play with the factor.
-- given: red (0...255)
distance = 255 - red
-- 30% more white
pastel_red = red + (distance * 0.3)
.@Codeslinger that looks good too. A while back I was messing with the blend and mix operations that were added with colors and wondered if I could do the same to achieve a pastel. this is what I came up with:
Pastel Bon Bons here was inspired by this discussion. The function pastelH2RGB(hue, strength) is based on the equilateral triangles that form a circumference, on the surface of the cube, below the white corner of the red, green, blue cube of colours.