static int FRAMERATE = 25;
float t = 0, dt = (float)1/FRAMERATE;
float sp[], rad[], ang[];
o.setPos("x",ptxa(rad,ang));
o.setPos("y",ptya(rad,ang));
o.setPos("s",ca(n,r/nt/25));
o.setOnd("s",ca(n,0.5),ca(n,period),ca(n,0),ofa(ia(n,d-period,0),0),ca(n,period),"psin");
o.setOnd("s",ca(n,0.5),ca(n,period),ca(n,0),ofa(ia(n,d-period,0),d-d*0.88),ca(n,period),"psin");
Oscillator(float amplitude, float period, float timeShift, float delay, float duration, String waveShape) {
this.amplitude = amplitude;
this.timeShift = timeShift;
this.duration = duration;
this.waveShape = waveShape;
if (waveShape.equals("sin")) {
} else if (waveShape.equals("psin")) {
value = pow(sin(TWO_PI*t/2),2);
} else if (waveShape.equals("id")) {
if ((t>=delay && (t<delay+duration) && duration != 0) || (t>=delay && duration == 0)) {
value = amplitude*wave((t-timeShift-delay)/period);
ArrayList<Oscillator> oscillators;
this.oscillators = new ArrayList<Oscillator>();
void addOsc(Oscillator osc) {
for (int i = 0; i < oscillators.size(); i++) {
value += oscillators.get(i).getValue();
float x, y, s, sx, sy, rz, cg;
float dx, dy, ds, dsx, dsy, drz;
MultiOscillator xOsc, yOsc, sOsc, sxOsc, syOsc, rzOsc;
x = 0; y = 0; s = 1; sx = 1; sy = 1; rz = 0; cg = 0;
dx = 0; dy = 0; ds = 0; dsx = 0; dsy = 0; drz = 0;
xOsc = new MultiOscillator();
yOsc = new MultiOscillator();
sOsc = new MultiOscillator();
sxOsc = new MultiOscillator();
syOsc = new MultiOscillator();
rzOsc = new MultiOscillator();
if (xOsc != null) {dx = xOsc.getValue();}
if (yOsc != null) {dy = yOsc.getValue();}
if (sOsc != null) {ds = sOsc.getValue();}
if (sxOsc != null) {dsx = sxOsc.getValue();}
if (syOsc != null) {dsy = syOsc.getValue();}
if (rzOsc != null) {drz = rzOsc.getValue();}
ellipse(0, 0, 10*(sx+dsx), 10*(sy+dsy));
void setOsc(String attr, float amp, float period, float timeShift, float delay, float duration, String waveShape) {
Oscillator osc = new Oscillator(amp, period, timeShift, delay, duration, waveShape);
} else if (attr.equals("y")) {
} else if (attr.equals("s")) {
} else if (attr.equals("sx")) {
} else if (attr.equals("sy")) {
} else if (attr.equals("rz")) {
print("wrong attribute");
this.cells = new Cell[n];
for (int i=0; i<this.n; i++) {
this.cells[i] = new Cell();
translate(this.x,this.y);
rotate((this.rz)*PI/180);
for (int i=0; i<this.n; i++) {
void setPos(String attr, float val[]) {
for (int i=0; i<n; i++) {
this.cells[i].x = val[i];
} else if (attr.equals("y")) {
for (int i=0; i<n; i++) {
this.cells[i].y = val[i];
} else if (attr.equals("s")) {
for (int i=0; i<n; i++) {
this.cells[i].s = val[i];
} else if (attr.equals("sx")) {
for (int i=0; i<n; i++) {
this.cells[i].sx = val[i];
} else if (attr.equals("sy")) {
for (int i=0; i<n; i++) {
this.cells[i].sy = val[i];
} else if (attr.equals("rz")) {
for (int i=0; i<n; i++) {
this.cells[i].rz = val[i];
} else if (attr.equals("cg")) {
for (int i=0; i<n; i++) {
this.cells[i].cg = val[i];
void setOnd(String attr, float amp[], float period[], float timeShift[], float delay[], float duration[], String waveShape) {
for (int i=0; i<n; i++) {
this.cells[i].setOsc(attr,amp[i], period[i], timeShift[i], delay[i], duration[i], waveShape);
float[] ia(int n, float f, float l) {
float ra[] = new float[n];
for (int i=0; i<n; i++) {
ra[i] = f + i*(l-f)/(n-1);
float[] ca(int n, float v) {
float ra[] = new float[n];
for (int i=0; i<n; i++) {
float[] ha(int n, float coef) {
float ra[] = new float[n];
for (int i=0; i<n; i++) {
float[] coa(float array[], float coef) {
float ra[] = new float[n];
for (int i=0; i<n; i++) {
float[] ofa(float array[], float offset) {
float ra[] = new float[n];
for (int i=0; i<n; i++) {
float[] spa(int n, int st) {
float a[] = new float[n+st];
for (int i=2; i<n+st; i++) {
a[i] = 0.5*(a[i-1]+sqrt(5*a[i-1]*a[i-1]-4*a[i-2]*a[i-1]));
float ra[] = new float[n];
for (int i=0; i<n; i++) {
float[] ptxa(float ra[], float aa[]) {
float xa[] = new float[n];
for (int i=0; i<n; i++) {
xa[i] = ra[i]*cos(PI/180*aa[i]);
float[] ptya(float ra[], float aa[]) {
float ya[] = new float[n];
for (int i=0; i<n; i++) {
ya[i] = ra[i]*sin(PI/180*aa[i]);