Is it possible to code a grouped panel and text?

My students were trying to set the opacity of some informational panels and, despite the objects being grouped, had to code the panel and the text separately. Is there a way around this?

Hi @MBridges!

Text items currently do not support opacity. That is why it feels like they have to be coded separately.

When using the set opacity - block on a group item, it’ll try to set the opacity of all items in the group that support opacity.

Right now, the best way to “hide” the text of a text panel is to set its text empty with the set text block.

Hi Stefan,

I was able to set the opacity of a text item but had to code opacity of both the panel and the text. Check out this space. https://cospac.es/5jwp

I was wondering if I could group the 2 items (panel and group) and just use one “set opacity” block. I can group them but it seems I still have to code separately.

Thanks!
Margo

Hello MBridges,

we are dealing with hierarchy of objects: text object is a child of panel. Generally some objects properties are inherited from it’s parent: if you change position or orientation of parent object, child objects also change thier positions.

However in general opacity property is not inherited from parent object, because otherwise it would be hard to make parent object more transparent than child. Opacity is inherited only from groups, because group doesn’t have it’s own body and it’s opacity can be used to simultaneous control of children opacities.

So, in your case you should create a group above the panel. Group panel with some temporary object (by selecting two objects together and pressing G) and than remove temporary object from result group using hierarchy tree.

Now you can use this group to control opacities of both panel and text either from editor or from blockly.

Thank you for such a detailed explanation! I love watching cospaces grow and am thrilled that you are all so receptive to our questions and input!

2 Likes

Hello MBridres,

now a workaround described above works in current version!

1 Like