# Phillip Trelford's Array

## POKE 36879,255

Richard Paul Lohse was a Swiss born painter and graphic artist who typically produced pieces that had “interacting colour elements in various logical/mathematical relations visible to the eye”

Out of curiosity I’ve taken a small number of Lohse’s work, generated them procedurally and added simple animations.

Sechs Serigraphien

Here I imagined the centre blocks bleeding out and filling the adjacent blocks a line at a time.

15 systematische Farbreihen mit 5 gleichen horizontalen Rythmen

This picture is composed of lines with a 15 row colour progression with each column having an offset. To animate it I rotate each column’s colours in an opposing direction.

Spiral

This Lohse inspired spiral consists of alternating block patterns animated anti-clockwise.

Opposing Spiral

The same pattern with alternating block patterns rotating clockwise and anti-clockwise.

Four Similar Groups

Here I imagined the red blocks shooting up and down and  from side-to-side.

Method

Each piece was generated procedurally using an F# script. A parameterized function is used to generate a frame as a bitmap, with a series of frames created to form an animated gif.

For example to draw the 15 lines

```// Column widths
let xs = [3;2;1;4;2;1;4;2;1;4;2;1;4;2;1]
// Column color offsets
let ys = [0;10;14;8;11;6;9;4;7;2;5;12;4;13;1]
// Image width and height
let width,height=476,450
// Block width and height
let w,h = 14,30

// Returns image using specified color offset
let draw n =
let image = new Bitmap(width,height)
use graphics = Graphics.FromImage(image)
for y = 0 to 14 do
List.zip xs ys
|> List.mapi (fun i xy -> i,xy)
|> List.scan (fun x (i,(dx,dy)) ->
let n = if i%2 = 0 then -n else n
let brush = brushes.[(15 + y + dy + n) % 15]
graphics.FillRectangle(brush, x*w, y*h, w*dx,h)
x + dx
) 0 |> ignore
image

// http://www.codeproject.com/Articles/11505/NGif-Animated-GIF-Encoder-for-NET
#r @"Gif.Components.dll"
open Gif.Components

let encoder = AnimatedGifEncoder()
if encoder.Start(@"c:\temp\15lines.gif") then
encoder.SetFrameRate(2.0f)
encoder.SetRepeat(0)
for i = 0 to 15 do