Automation from sunset to a specific hour

hi everybody! i’d like to do an automation that turn off my light slowly (transition) from sunset to 9pm. is that possible and what I have to do?! thank you!