This browser has no WebGPU, so the sketch cannot run here. The program is below, and it runs in a current Chrome, Edge or Safari.
Trig 3D
Use a 2D sine field to displace cube instances along the Z axis
///////////////////////////////////////////////////////////////
// trig-3d
// Use a 2D sine field to displace cube instances along the Z axis.
///////////////////////////////////////////////////////////////
&time = mlt(step, 0.003); // scale step into a slower time value
&dim = (64,64,1); // 64 × 64 2D field
#A{
dim = &dim;
run =
sin(
mlt(
// offset phase by distance from the origin
add(&time, dst(C, 0)),
8 // spatial frequency
)
);
}
~A {
dim = &dim;
col =
mix(
(0.4, 0.2, 0.1), // red
(0.1, 0.4, 0.4), // teal
#A // use field value as mix factor
);
rot = (HALF_PI, 0, 0);
shape = CUBE;
// use field value to displace each instance along Z
i_pos = (C.x, C.y, mlt(#A, 0.1));
}