Yes, you’re sampling the image and that gives 4 values in an array [r, g, b, a]
Position needs 2: [x,y].
So you’ll have to do some kind of calculation on the color to translate it into a position-value.
For example add this final line:
[x[0], x[1]]*20;
And it will use red and green (0th and 1st element of x] with white moving 20px, black zero…