LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fading controls (visual FX): is it possible?

Solved!
Go to solution
I made a sort of wizard in Labview, there is a tab control, each tab contains some controls (numeric and enums, they are parameters for a device), user can navigate back and forth with next/previous buttons.
At the end of the wizard, the final tab shows some buttons ON THE LEFT asking "what to do now?".
One button is to print the pameter list. When you click it, another window opens (it's a statically linked VI, modal) to set up name of the printer, number of copies, title and Print/exit buttons.

What I would like to do is AVOID this window, and let these controls appear with a fading (from transparent to 100%) on the space that I have in the final tab, on the right.

Does anyone know how to obtain such a transaction? by mean of a property of the controls? Something like :
For loop 10 times {
   wait 50ms;
   button1.transparency += 10;
   printerList.transparency += 10;   
}

Or by mean of a "layer" (how? a decoration?) that becomes transparent (from 100 to 0) ??

Thanks
0 Kudos
Message 1 of 10
(5,171 Views)

Hi there

 

you can create a modal FP without title bar, tool bar, menu, scroll bars etc, run the VI, place the FP over the last tab page using Front Panel Window:Panel Bounds and set the FP properties "Run transparently = TRUE" and the Transparency to a value between 0 and 100. Should work!

 

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 2 of 10
(5,163 Views)

Could you explain better how I place a front panel over another front panel?? 

I created the transparent VI like you said, but how can I change the transparent property programmatically?

 

The flow is : Print button value change event --->  make a fading transition (from 100% transparent to 0% transparent)

 

thanks 

0 Kudos
Message 3 of 10
(5,147 Views)

Hi,

to set transparency programmatically, you can use property node "FP: Transparency" (place a property node, set class to VI server -> VI -> VI, select Front panel window -> Transparency). If you want to obtain a fading effect, connect the input value to 100 - the iteration terminal of a for loop iterating 100 times. In this way, the transparency property will change from 100 to 0 %.

I hope this will help!

Bye!

Licia

0 Kudos
Message 4 of 10
(5,110 Views)

But I don't want to create another VI to place over the FP, and set its transparency....

I want to control only the picture control transparency.

Need to extract the content of the image, alter bit by bit and re-draw??? seems weird and time consuming (in a loop N step)

0 Kudos
Message 5 of 10
(5,014 Views)

Slyfer wrote:

Need to extract the content of the image, alter bit by bit and re-draw???


Since LabVIEW does not support transparency for controls and you don't want a separate VI, the answer is yes. Note that to do transparency, you need to get every pixel of the BG and FG images, break into its RGB components and then average the two values (using a weight for the percentage of transparency) and build the image back. The code for this is actually pretty simple.


___________________
Try to take over the world!
Message 6 of 10
(5,010 Views)

tst, try to run my vis, it's LV8.5.1

telle me if it's what you meant and if it can be made better. If there are too much "steps" in the fade effect, I notice bad "redrawing" performance

That is the smooth FX I was intended to do.

Around the forum I found the PNG files support alpha blending channel, but I am not able to exploit it, because that value (alpha) should be in the "mask" variable of the image, and with my files it's always empty value (I tried with PNG images but they were 24 bit, not 32 like it's said in the documentation)

 

thanks

Message Edited by Slyfer on 12-03-2008 04:24 PM
0 Kudos
Message 7 of 10
(4,993 Views)
Solution
Accepted by topic author Slyfer

Here's one which seems to work smoothly (backsaved to 8.0). Note that I disabled the Erase First property on the picture control.

 

You should note that this will only work if both images are exactly the same size, as the arrays need to be aligned.

 

As for the transparent PNG, LabVIEW does read the alpha channel, but ignores it when drawing. You can do the same sort of sort of merging we did here by reading the alpha channel yourself (every fourth element of the image array, which you can get by using the Decimate Array function). You would probably want to have some code to pad the images so that they are the same size.

 

If you come up with something, why not post it, so that others can use it as well?


___________________
Try to take over the world!
Message 8 of 10
(4,953 Views)

tst, thanks for the improvement. I forgot it's better for LV to operate with array data type, so I changed my code avoiding the inner for loop.

The "flickering" update was due to the "erase first" property, which must be turned off, and can be changed programmatically at runtime also.

If I came up with a general subroutine, where can I post it? How can I merge the GPL into it?

0 Kudos
Message 9 of 10
(4,935 Views)

You should note that my quick example wasn't that efficient either, as it does stuff inside the loop which could be moved outside and done once (not that it really matters, since the LV compiler recognizes this and does the optimization automatically).

 

As for releasing this, most people who post a code snippet or only a few VIs don't bother with a license and just post the code. If you do want to use a license, I would advise against GPL as it's very restrictive. BSD is very convenient for the user. If you want, the LAVA forums had some discussions on this and you can search there. If you want to see an example of code with a license, you can download the very useful toolkits from OpenG.

 

As for where to post it, you can simply post it here and hopefully someone will search and run into it. Alternatively, you can try sending it to NI's code sharing site and to the LAVA forums' code repository.


___________________
Try to take over the world!
Message 10 of 10
(4,923 Views)