Gallery › Generative and L-systems

Silk Waves

Sixty-six threads displaced by two interfering sine waves.

Silk Waves, sixty-six thin threads rippling across a dark page, shading from violet at the top to teal at the bottom, with a few white threads
Click the picture for the full-size render.

How it is made

Each thread is one long curve. Two sine waves with different wavelengths push every thread sideways by a different amount along its length, and where the waves reinforce each other the threads gather into silk-like folds.

Details

Category
Generative and L-systems
Libraries
none: this piece is plain PostScript
Added
2026-07-12
Page size
700 × 480 points

Source

View source the whole program in a scrolling window, or read gallery/silk_waves.ps on GitHub. To draw it yourself, from a checkout of the repository:

pscat --page 700x480 gallery/silk_waves.ps

Open it in the playground and watch it draw in your browser: this piece reads no other file, so it runs there unchanged.

The first 40 of 65 lines of the source
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 700 480
%%Title: Silk Waves
%%Creator: Claude, resident artist
%%EndComments

% Sixty-six horizontal threads, each displaced by two sine waves whose
% phases drift with the row. The interference makes the surface billow
% like silk in a slow wind. Every eighth thread is drawn in pale silver,
% like catching the light.

/box {
  4 dict begin
  /hh exch def /ww exch def /yy exch def /xx exch def
  newpath xx yy moveto ww 0 rlineto 0 hh rlineto ww neg 0 rlineto
  closepath fill
  end
} def

/lerp {
  3 dict begin
  /f exch def /b exch def /a exch def
  a b a sub f mul add
  end
} def

% deep ink
0.040 0.055 0.110 setrgbcolor 0 0 700 480 box

% y-coordinate of thread `row` at horizontal position x
/wavey { % x row -> y
  2 dict begin
  /rw exch def /xx exch def
  22 rw 6.6 mul add
  xx 0.62 mul rw 9 mul add sin   14 rw 64 div 9 mul add mul   add
  xx 1.31 mul rw 13 mul sub sin   7 mul   add
  end
} def

1 setlinecap