Script with an array and setting brightness based on the count in repeat

I suggest you try using the Light integration’s transition option.

If your light is unable to support this feature natively, then I suggest you use this script: