161j Trump

(meta linear-colour-space: 1)

(define
  ;; fade out any lines which are far away from the focal points
  interest (interp/build from: [0.2 1.5] to: [0 1] clamping: true))

;; call 'fun' for every point on a nXn grid on the canvas
(fn (grid n: 10 fun: 1)
  (define
    remap-x (interp/build from: [0 (- n 1)] to: [0 canvas/width])
    remap-y (interp/build from: [0 (- n 1)] to: [0 canvas/height]))
  (loop (y from: 0 to: n)
    (loop (x from: 0 to: n)
          (fn-call (fun position: [(interp/value from: remap-x t: x)
                                   (interp/value from: remap-y t: y)])))))

;; render the background grid
(define
  focal-bg-a (focal/build-point position: [{411 (gen/int min: 400 max: 600)}
                                           {284 (gen/int min: 100 max: 400)}]
                                distance: {727 (gen/int min: 700 max: 1000)}
                                falloff: linear)
  focal-bg-b (focal/build-point position: [{448 (gen/int min: 400 max: 600)}
                                           {690 (gen/int min: 600 max: 900)}]
                                distance: {993 (gen/int min: 700 max: 1000)}
                                falloff: linear)
  col-fn-bg (col/build-bezier a: {(col/rgb r: 0.610 g: 0.968 b: 0.362 alpha: 0.439) (gen/col)}
                              b: {(col/rgb r: 0.516 g: 0.842 b: 0.214 alpha: 0.372) (gen/col)}
                              c: {(col/rgb r: 0.106 g: 0.947 b: 0.362 alpha: 0.833) (gen/col)}
                              d: {(col/rgb r: 0.326 g: 0.012 b: 0.656 alpha: 0.147) (gen/col)}))

(fn (draw-element-bg position: [0 0])
    (define
      interest-a (focal/value from: focal-bg-a position: position)
      interest-b (focal/value from: focal-bg-b position: position)
      combined-interest (+ interest-a interest-b)
      alpha (interp/value from: interest t: combined-interest))
    (on-matrix-stack
      (translate vector: position)
      (rotate angle: (* combined-interest {370 (gen/int min: 300 max: 400)}))
      (circle position: [0 0]
              colour: (col/set-alpha from: (col/value from: col-fn-bg t: interest-a) value: alpha)
              width: {45 (gen/int min: 30 max: 60)}
              height: {414 (gen/int min: 400 max: 500)}
              tessellation: 20)))

(grid n: {38 (gen/int min: 30 max: 40)}
      fun: (address-of draw-element-bg))

;; render the foreground
(define
  focal-fg-a (focal/build-point position: {[631 384] (gen/int min: 0 max: 1000)}
                                distance: {393 (gen/int min: 0 max: 500)}
                                falloff: linear)
  focal-fg-b (focal/build-point position: {[709 98] (gen/int min: 0 max: 1000)}
                                distance: {588 (gen/int min: 0 max: 600)}
                                falloff: linear)
  col-fn-fg (col/build-bezier a: {(col/rgb r: 0.622 g: 0.496 b: 0.132 alpha: 0.131) (gen/col)}
                              b: {(col/rgb r: 0.746 g: 0.828 b: 0.127 alpha: 0.863) (gen/col)}
                              c: {(col/rgb r: 0.841 g: 0.529 b: 0.047 alpha: 0.402) (gen/col)}
                              d: {(col/rgb r: 0.783 g: 0.860 b: 0.825 alpha: 0.429) (gen/col)}))

(fn (draw-element-fg position: [0 0])
    (define
      interest-a (focal/value from: focal-fg-a position: position)
      interest-b (focal/value from: focal-fg-b position: position)
      combined-interest (+ interest-a interest-b)
      alpha (interp/value from: interest t: combined-interest))
    (on-matrix-stack
      (translate vector: position)
      (rotate angle: (* combined-interest {125 (gen/int min: 1 max: 200)}))
      (circle position: [0 0]
              colour: (col/set-alpha from: (col/value from: col-fn-fg t: interest-a) value: alpha)
              width: {12 (gen/int min: 10 max: 30)}
              height: {164 (gen/int min: 100 max: 300)}
              tessellation: 20)))

(grid n: {35 (gen/int min: 30 max: 40)}
      fun: (address-of draw-element-fg))