88 views
in GUI Development by
Hi,

I've got a situation where old content and new content undergo fading transitions - old content faded out, new content faded in using the FadeCroup method on the container of all GUI screen (This parent into which screen are added/changed as the user navigates round the system). The base class of the content is a Group as this is what we use to define screens.

We've identified that 'during' the Fade transition, events may come in that require a current screen change to be cancelled and the new content 'snaps' in as the new content without a transition.

Looking at the faders, I am thinking that to do this I can call:

contentCroup.pendingFade.task.RemoveFade(contentCroup.pendingFade)

To cancel any ongoing fades?

Is the this right approach?

1 Answer

+1 vote
by

Hello,

If the animation is already in progress, this will not work because pendingFader does not refer the actually running fader anymore. In fact, the concept of faders does not allow the possibility to abort an already running animation. Once started the animation has to complete.

If the animation is not yet started (it is pending in the queue), it would be sufficient to start another Fader (e.g, to hide the group again) for the affected group. This will automatically cancel the preceding (e.g. show) fader. In fact, there is always max. one fader to animate one group possible. Therefore specifying a new fader for the group which already has a 'pending' fader cancels the pending fader and stores the new fader.

I would recommend to handle this functionality by using Effects instead of Faders. Effects implement a lower level concept. When using effects you can start/stop the effect at any time. For example, to fade-in/out a group you could use the Change Int32 Effect and control with this effect the Opacity property of the group. See also Connect the Animation Effect with a property to animate.

Best regards

Paul Banach

by
Thanks for your reply,

I switched my class that implements the transition animation to use Effects rather than faders and it looks the same. (All transitions are encapsulated using a standard IScreenTransition interface, so it was quick change.)

As you say,. I can cancel the effect whenever I want, so this is a better solution.

Thanks!
by

Just another question - some of the bitmaps on the screen have transparency in them and are used to give certain effects to the graphics beneath them. When I fade the Group, the opacity of the bitmaps changes - so transparent change their opacity and become visible while I'm fading. I import the bitmaps as Native (Importing them as Alpha8 doesn't work at all.)

Opacity of the group is 255, mask works fine.

Opacity set to 100:

Is it possible to fade this group and keep the mask intact throughout the fade?

by
I seem to have been able to fix this by specialising Views::Image, overriding the Draw Method and making supe aOpacity of 255 is passed into the superclass.

This works and I no longer see glitches while the group is fading away.

I have no idea if this is the best solution, though! Feels a bit of a hack.
by

When I fade the Group, the opacity of the bitmaps changes - so transparent change their opacity and become visible while I'm fading.

Changing opacity of a group affects the opacity of all views found inside the component. When you don't want this behavior, configure the group to be Buffered. Then the content of the group is composed inside an off-screen buffer and the opacity os applied to the buffer itself. Disadvantage: you need memory for the off-screen buffer. Please see also the section Control the visibility of nested components

I seem to have been able to fix this by specialising Views::Image, overriding the Draw Method and making supe aOpacity of 255 is passed into the superclass.

This would mean, that opacity of the bitmap does not change. If this is the expected behavior, don't fade-in/out the group. Instead fade-in/out only the views inside the group you want to animate. The image, in turn, remains with its full opacity.

I have no idea if this is the best solution, though! Feels a bit of a hack.

Yes, I would not recommend such modifications unless it is inevitable.

by
There are 100 or so screens and the transition between them is a fade out/in of old and new content, and many of them have bitmaps that purely there as transparency and I do not want their opacity to change at all. I would have to go through each 'group' and work out which ones to fade during a screen transition.

Creating a specialised Views::Image that can be used by transparent bitmaps used for visual purposes seems the easier solution to me at the moment. (I don't have the memory for another buffer).

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...