Idea:- Generate Three Phase to give an RGB value to get rainbow fades A lot of Rainbow fades use HUE and a Hue2RGB() function. Could I use N Darwoods's Three Phase method? yes - but you need to clip. This is based on a Wireless World article by N Darwood in November 1982. Itterate these each time slice:- A=A+n*(B-C) B=B+n*(C-A) C=C+n*(A-B) If A, B, C map to R, G, B If these clip, and go greater than 100% and the colours are pleasing. The SVG rgb(r%,b%,g%) function clips the values to 0% to 100%.

// Sine waves using sin() and cos() period += increment rad= 2*PI*period Y=mag*sin(rad) or Y=mag*cos(rad)// Sine waves using complex numbers // and accumulator. A=A*M rad = 2.0 * Math.PI * 0.2 mag = 1.0 M.re=mag*Math.sin( rad ) M.im=mag*Math.cos( rad ) at= mr*ar-mi*ai ai= mr*ai+mi*ar ar=at

// Sine waves using differential equations Itterate these each time slice:- x=x+y*n y=y-x*n This is the solution to d^2 V/dt^2 = -nV dV/dt = j n V Numerically solve re_next = re_now + gradient * step length re_next=re_now+im_now*n im_next=im_now-re_next*n This is a combination of the forward and backward integration and are stable however the forward Euler integration explodes re_next=re_now+im_now*n im_next=im_now-re_now*n however the backward Euler integration explodes re_next=re_now+im_next*n im_next=im_now-re_next*n

Idea:- Generate Three Phase to give an RGB value This is based on a Wireless World article by N Darwood in November 1982. Itterate these each time slice:- A=A+n*(B-C) B=B+n*(C-A) C=C+n*(A-B) If A, B, C are three axis 120 degree relative to each other. A=cos( 2*pi*t/T ); B=cos( 2*pi*t/T + 2*pi/3 ); C=cos( 2*pi*t/T + 2*pi/6); Using complex numbers:- B= M*A C= M*M*A A= M*M*M*A M.re = cos(2*pi/3 ) M.im = sin(2*pi/3 ) Why is this stable? Assume it is a solution of a differential equation? forward Euler uses the gradient at now backward Euler uses the gradient at now+1 They each have an error which must cancel. Assume A1 is the next itteration of A0, B1 is B0 + update These must be executed in the order below without A1=A0+n*(B0-C0) // forward Euler A1 is based on now values of B and C B1=B0+n*(C0-A1) // Forward and backward Euler integration, based on old and new C1=C0+n*(A1-B1) // backward Euler C1 is based on new A and B