sbox-issues icon indicating copy to clipboard operation
sbox-issues copied to clipboard

Razor UI Elements Don't Play Outro

Open damienfamed75 opened this issue 3 years ago • 12 comments

Describe the bug

Any razor elements that has an intro or outro specified in the stylesheet doesn't play.

To Reproduce

Add an outro to a razor UI element and delete it with immediate = false

Expected behavior

When deleting a razor UI element the outro should play, same with the intro

Media/Files

Here's just a black screen with a button to Delete the razor element. I have set that all events have a 5 second transition ease-in-out, but as you can see it's just instant

https://user-images.githubusercontent.com/17505288/202782259-34db13a4-452f-4c98-8e9b-0b255388150a.mp4

Additional context

No response

damienfamed75 avatar Nov 18 '22 19:11 damienfamed75

I ran into this as well when converting my UI to razor. It would be nice if we could apply &:intro and &:outro to elements when they are programmatically created/removed via razor.

@foreach(var item in Items)
{
  // <ItemThing @Item=@item />
}

where ItemThing in this case would play the intro / outro if it is created/deleted on the next re-render.

matekdev avatar Dec 21 '22 05:12 matekdev

Any chance this can be added to the tracker? Can confirm it's still an issue. In my case, conditionally rendered blocks do not get an outro played on them.

trundlr avatar Mar 22 '24 17:03 trundlr

Yeah it would be nice if we could get this fixed!

matekdev avatar Mar 22 '24 18:03 matekdev

pretty sure this is working for me, is this a hashing issue?

MrBrax avatar Mar 22 '24 19:03 MrBrax

pretty sure this is working for me, is this a hashing issue?

Nope!

trundlr avatar Mar 22 '24 19:03 trundlr

seems like i was imagining things, it is broken yes

MrBrax avatar Mar 22 '24 21:03 MrBrax

I am pretty sure that outros were working for me too when deleting a panel.

But intros and outros have a habit of skipping when:

  • Toggling fullscreen mid-transition.
  • Destroying the panels component.

badandbest avatar Apr 05 '24 09:04 badandbest

I am pretty sure that outros were working for me too when deleting a panel.

But intros and outros have a habit of skipping when:

  • Toggling fullscreen mid-transition.
  • Destroying the panels component.

Yes they work fine when deleting them. It's when conditionally rendering them via razor that is busted.

It might be worthwhile to provide some reproductions for your cases.

matekdev avatar Apr 05 '24 09:04 matekdev

Just tested this, still busted.

matekdev avatar Jul 21 '24 23:07 matekdev

Some other edge cases around intro and outro that need some love:

  • Enabling and disabling a PanelComponent does not play intro/outro
  • Manually setting a class on enabled does not play transitions for said class (ie set show which sets the opacity to 1, and the element has opacity: 0 and transition: opacity 1s on it)

trundlr avatar Dec 10 '24 00:12 trundlr

It's 2025 and it would be amazing to have this

matekdev avatar Mar 17 '25 04:03 matekdev

@garrynewman Hey this is in response to the latest changes here https://sbox.game/news/june-2025#razor-outro

Here is a reproduction project with an issue and some questions. If you launch the project, you should see three different coloured squares.

White Square (Outro.razor)

When you hold down space you do NOT get the outro effect on the square. I believe this should be a bug.

Red Square (Render.razor)

Do you think the red square should render? Since we have the if (true) return; it never reaches the <root />. What do you think?

Aqua Square (Item.razor)

There are situations where you want to hide/show a UI element based on whether or not something is valid. For instance, in my example, I have a reference to a MyCustomItem which becomes null if you hold space. The issue arises that the <p>@MyCustomItem?.Name</p> ends up empty on the outro since it's null. I can't confirm it for sure, but, I feel like before your changes it would maintain the last known value during the outro.

Regardless, what's your recommendation for situations like this? Ideally, I'd like to use razor similar to the red square example and outro the entire element if it is null. Is that a reasonable request?

Let me know if you have any questions, thanks.

ui_repro.zip

matekdev avatar Jun 06 '25 05:06 matekdev