This is much more complicated than it needs to be.
.play({
script: [
{props: {expr: function (emit, x, y, i, j, time) {
emit(x, Math.sin(x + time) * Math.sin(y + time), y);
}}},
{props: {expr: function (emit, x, y, i, j, time) {
emit(x, Math.cos(3*x + time) * Math.cos(3*y + time), y);
}}},
{props: {expr: function (emit, x, y, i, j, time) {
emit(x, Math.cos(Math.cos(x*3) + x + time) * Math.cos(3*y + time), y);
}}},
],
delay: 1,
pace: 2,
loop: 3,
});
Although in your case, because you have static input data, you shouldn't need `expr` at all, and can just use `data` directly on the area/matrix element. As long as you set the input dimensions and channel count correctly, it should automatically pick up stride on the array(s).