;; RGB Split effect - chromatic aberration

(define-effect rgb_split
  :params (
    (offset_x :type int :default 10 :range [-50 50])
    (offset_y :type int :default 0 :range [-50 50])
  )
  (let* ((r (channel frame 0))
         (g (channel frame 1))
         (b (channel frame 2))
         (r-shifted (translate (merge-channels r r r) offset_x offset_y))
         (b-shifted (translate (merge-channels b b b) (- offset_x) (- offset_y))))
    (merge-channels (channel r-shifted 0) g (channel b-shifted 0))))
