stevon8ter's color picker [FINISHED]

@Luatee +1 @Jmv38 Triple-tap with three thingers to exit to FULLSCREEN mode.

@Jmv38 Can’t you do a 3-finger tap to show the buttons when FULLSCREEN_NO_BUTTONS is on?

@Jmv38 yeah I know what you mean :wink:
But I’ll leave the fullscreen_no_buttons, since it’s only for the example, the class itself doesn’t contain that code :wink:

@Andrew_Stacey, could you maybe help me figure out how to choose the colors from my hexagon shape, I don’t really get how you library worked, I looked at it, found the colorchoosed things, but can’t really seem to find out how it works exactly, thx in advance (we could talk in pm if this would take to much time or space for on the topic itself)

Edit: also, another reason of slow fps could be the calculating of the indicator position, it uses some calculations with angles and i don’t know if those are very expensive…
I tried to minimalising the calculations by doing math.sqrt(3)/2 instead of math.sin(60)

@stevon8ter yup! No big deal, i just wanted to let you know. It is frightening to see you’ve lot control of codea…

My guess is that the frame rate drop is due to your use of the image:get function to get the current colour (line 188 looks to me as though this is used there). Its convenient, but expensive. Far better is to compute the colour mathematically from the touch coordinates (see my colour picker in my Library Base project in the Colour tab).

@stevon8ter outch! Remove the _NO_BUTTONS! I had to kill my codea to get out of your program!

@Jmv38 sorry :s what happened? when weren’t you able to leave it?

@Andrew_Stacey, I’ll definetly take a look at it, thanks

I fell asleep last night rather early so I didn’t make any progress yet, but the drawing of the square mesh will change as well I think, to an image, that might save some fps as well?

But definetly going to look into the library

@Andrew_Stacey you’re pbly right, i just noticed the best values were close to 60.

@Jmv38 like @Andrew_Stacey said, there’s no code for the square yet, it shouldn’t be that hard tho, but I just don’t have alot of time right now, but holidays started so I’ll try to finish it soon

Ok lads, first, sorry for bumping this old discussion but I’m here to say I finally felt like finishing it a little more

http://twolivesleft.com/Codea/CC/alpha/index.php?v=1156

Now it should support multitouch so that you can choose both the hexagon color as the main color at the same time
Also, try going outside or more to the inside of the hexagon and move your finger, the indicator now stays where it should be

To do: the main color picker, am at it right now, should take that very long, but I’m already up for almost 61 hours by now so yeah you kinda get that things don’t go that fast now xp

It runs at 60fps except when touching, it still drops to around 30

Thanks to @Andrew_Stacey’s encouragment to do calculations instead of image:get, it currently runs around 60fps constantly :wink:
(I didn’t use anything from your library tho, I tried to research it on my own so yeah probably alot of improvement possible)

http://twolivesleft.com/Codea/CC/alpha/index.php?v=1167

Left to do:

  • Square colors (idk yet how i’ll calculate this but I’ll find out soon :wink: gonna do some calculations later this evening)
  • Alpha slider
  • Small background thing for the whole colorpicker (like in codea editor, so that it doesn’t run on the programs background)

Great! Always best to work it out for yourself.

I actually got distracted by the bad blending of colours on the hexagon (it’s on mine as well, but as my hexagon is thinner it 's not so obvious) and worked on a gradient fill for quadrilaterals.

@Andrew_Stacey yeah I noticed that too…
but you can set the width of the border and total size etc

so try replacing this in the setup

lol = Colorpicker(WIDTH/2, HEIGHT/2, 200, 25)

Also, I know the colorblending in the rectangle is even worse :confused: does anyone have any ideas on how to make the rect colors look more like the codea editor one?

I’m sorry to bump this thread, but I read more about shaders etc, and I was wondering, TLL @Simeon @John how do you blend your rectangle colors so nicely? (for the built in colorpicker) Do you use a shader-like thing or some method with pictures or what?

I have a shader (on CC) for this. It’s an interesting problem: if you simply shade the triangles then unless the quadrilateral is a parallelogram it won’t look right. You have to shade them knowing the shape of the quadrilateral at the outset.

@Andrew_Stacey I saw your shader etc, but even when downloading cmodule and linking it as dependencie, it doesn’t work :s

Edit: it doesn’t even wanna download completely, it’s that big that it freezes…

[double post]

Ooops! I’ve just looked at the code on CC and that is not what was meant to be there!

For organisational reasons, I keep most of my small projects in one big project. The upload was meant to be just one of the tabs from that project, but it appears to have uploaded the entire thing. I’ll fix it.

Okay, it’s fixed. It is now a single tab: http://twolivesleft.com/Codea/CC/alpha/index.php?v=1340

thanks @Andrew_Stacey, I’ll take a look at it :slight_smile: