Opacity on entities

Not sure if this is possible.

I’d like to be able to set opacity on entities.

Usecase: When a player dies, a ghost rises from their body. I’d like it to fade out after a certain threshold, so it doesn’t jarringly vanish.