SetTextOpacity

Hello,
I’m trying to understand how I can use SetTextOpacity on a text_block. Looking at the function:

Sets the opacity of the displayed text.

        SetTextOpacity<native><public>(InOpacity:type {_X:float where 0.000000 <= _X, _X <= 1.000000}):void

Which I’ve been able to figure it is a type macro. I wanted to fade text in and out in a suspend function. It will accept a float directly, but if I put the same float in a varialbe, no luck. Any help would be greatly appreciated.
Cheers!

How you can put a variable as a text opacity:
if (Opacity := type{_X:float where 0.000000 <= _X, _X <= 1.000000}[OpacityFloat]): TextBlockChange.SetTextOpacity(Opacity)

Now you just need to figure out a function that modifies the number from 1.0 to 0.0.
I can imagine that being something like this:
for (OpacityInt := 0…100):
OpacityFloat := OpacityInt * 1.0 / 100.0
if (Opacity := type{_X:float where 0.000000 <= _X, _X <= 1.000000}[OpacityFloat]):
TextBlock.SetTextOpacity(Opacity)

Really appreciate the help!

    FadeTextOutOneSecond()<suspends>: void = 
        for( Iteration := 1..9):
            var IntToFloat : float = Iteration * 0.1
            var ReverseFloat : float = 1.0 - IntToFloat
            if (Opacity := type{_X:float where 0.000000 <= _X, _X <= 1.000000}[ReverseFloat]):
                Sleep(0.1)
                WidgetTextBlock.SetTextOpacity(Opacity)
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.