scls19fr Posted June 5, 2008 Report Share Posted June 5, 2008 Hello, I would like to change the color of a tank according the value of a slider. If slider value is 0 the color should be blue. If slider value is 100 the color should be red. If slider value is between 0 et 100 the R G B values should be between the RGB values of blue and red I don't know how to do this... I know how to set a red color to my tank using property node and color constant box but I don't know of to make a linear colormap. I'm also interessed in adding more colors to my colormap. For example 0= blue 20=green 60=yellow 100= red Thanks Best regards Quote Link to comment
jgcode Posted June 5, 2008 Report Share Posted June 5, 2008 This should get you started.. Good luck JG Download File:post-10325-1212573974.vi Code is LV8.0 Quote Link to comment
LAVA 1.0 Content Posted June 5, 2008 Report Share Posted June 5, 2008 See here for Greg McKaskle's answer (I used my Color Ramp tag to find this one). and See here for examples that Christian and I offered (on the dark-side). Ben Quote Link to comment
jgcode Posted June 5, 2008 Report Share Posted June 5, 2008 QUOTE (neB @ Jun 4 2008, 07:18 PM) http://forums.ni.com/ni/board/message?board.id=170&message.id=209743&query.id=56852#M209743' target="_blank">See here for examples that Christian and I offered (on the dark-side). Nice post :thumbup: thanks Ben. Thats the funky algorithm I was talking about! Quote Link to comment
scls19fr Posted June 5, 2008 Author Report Share Posted June 5, 2008 CITATION(jgcode @ Jun 4 2008, 02:07 PM) Nice post :thumbup: thanks Ben.Thats the funky algorithm I was talking about! Thanks guys I ever found the sample on NI Forum http://forums.ni.com/ni/board/message?boar...d=56852#M209743 ... but I didn't found the good keywords to get it again ! I see the sample you provide to me in the previous links Unfortunately noone make something that could be easily be changed to fit to any number of colours (for the ramp) I think a good sub-vi for this should provide 3 inputs and one output 1 input for array of colors 1 input for array of stop values (same size as the previous array) 1 input for value (between 0 and 1 as float) 1 output for the resulting colour I think a good starting point for this could be the vi of Ben. I post it here. Quote Link to comment
eaolson Posted June 5, 2008 Report Share Posted June 5, 2008 QUOTE (scls19fr @ Jun 4 2008, 02:57 AM) I would like to change the color of a tank according the value of a slider. The way that came to mind for me is to use your input value as the H on the HSV scale. Scale your input value to [0,360) and http://en.wikipedia.org/wiki/HSV_color_space#Conversion_from_HSV_to_RGB' rel='nofollow' target="_blank">convert to RGB using S = 1 and V = 1. It's not real difficult, but complicated by the lack of a native HSV to RGB conversion in LabVIEW. You might also want to scale the input value starting at 240° (blue) to 0° (red) rather than from 0 to 360. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.