Cindy(
{
ports: [
{
id: "colorplot",
width: width,
height: width,
transform: [
{
visibleRect: [-10, 10, 10, -10]
}
]
}
],
animation: {
autoplay: true
},
scripts: {
init: `
W(x, t, p) := sin(5*|x-p|-t); //helper function
resetclock();`,
draw: `
colorplot(
u = W(#, seconds(), A) + W(#, seconds(), B);
gray(1/2+u/4) //the last line is the return value!
);`
},
geometry: [
{ name: "A", kind: "P", type: "Free", pos: [-4, 4] },
{ name: "B", kind: "P", type: "Free", pos: [3, -8] }
]
},
visibility,
invalidation
)