Fast LED Automation

I have an LED strip under my bed that is activated by a motion sensor at night.
The automation works as expected but I could use some insight on how to tweak it.

Currently when the motion is activated the strip comes on for its 10 seconds.
What I would like is for the strip to increase its brightness to 50% and then at 5 or 6 seconds start to decrease until it goes off after 10 seconds.

So at 0 to 4 seconds it goes for 0% to 50% brightness and then at 6 seconds it goes from 50% to 0% at 10 seconds.

Here is the automation.
Any ideas on how to do this.

####################################################
#     CWB BED FLED LIGHTS ON BLUE 2022Jan11        #
####################################################
- id: "7d35bbbf-73fd-4111-9522-04408daaa15a"
  alias: "FLED - Bed Led Lights ON"
  description: FLED Bed Led Lights ON
  trigger:
    - entity_id: binary_sensor.motion_sensor_bed_carlton
      platform: state
      to: "on"
      from: "off"
  condition:
    condition: time
    after: "17:00:00"
    before: "07:30:00"
  action:
    service: light.turn_on
    data:
      entity_id: light.bed_lights_carlton_fled
      rgb_color: [128, 0, 255]
      brightness: 50
  mode: single
####################################################
#     CWB BED FLED LIGHTS OFF  2022Jan11           #
####################################################
- id: "8fc2a243-1376-4740-8564-f376170486e9"
  alias: "FLED Bed Led Lights OFF"
  description: FLED Bed Led Lights OFF
  trigger:
    - entity_id: binary_sensor.motion_sensor_bed_carlton
      for: 00:00:10
      platform: state
      from: "on"
  condition: []
  action:
    - entity_id: light.bed_lights_carlton_fled
      service: light.turn_off
  mode: single
####################################################
#            END OF CONFIGURATION FILE             #
####################################################