An extension of this question, I'd like to create multiple locators as per the example below:
Manipulate[
With[{pts = Append[#, First[#]] &@
Table[{r {Cos[phi], Sin[phi]}, phi/(2 Pi)}, {phi, 0, 2 Pi,
1/10}, {r, 0, 1, 1/10}]},
DynamicModule[{constrain, dots = {{.5, .5}}},
constrain = If[Norm[#] < 1, #, Normalize[#]] &;
LocatorPane[Dynamic[dots, (dots = constrain /@ #) &],
Graphics[{Polygon[{{0, 0}, First[#1], First[#2]},
VertexColors -> (Hue /@ {{0, 0, 1}, Last[#1], Last[#2]})] & @@@
Partition[pts[[All, -1, {1, 2}]], 2, 1],
Dynamic[{EdgeForm[Black],
Hue[Module[{a, b}, b = (List @@@ dots)[[1]];
a = Quiet@(180 ArcTan[#2/#]/Pi) & @@ b;
If[Positive[b[[1]]] && Positive[b[[2]]], a,
If[Negative[b[[1]]] && Positive[b[[2]]], 180 + a,
If[Negative[b[[1]]] && Negative[b[[2]]], 180 + a,
If[Positive[b[[1]]] && Negative[b[[2]]], 360 + a,
If[b[[2]] == 0 && Positive[b[[1]]], 360,
If[b[[1]] == 0 && Positive[b[[2]]], 360/4,
If[b[[2]] == 0 && Negative[b[[1]]], 360/2,
If[b[[1]] == 0 && Negative[b[[2]]], 360/4]]]]]]]]]/360,
Evaluate@EuclideanDistance[{0, 0}, dots[[1]]], b],
Disk[#, Scaled[.05]] & /@ dots}]}],
Appearance -> None]]], {{b, 1}, 0, 1}, ControlPlacement -> Top]
ie, the aim is to make a dynamic version of this:
I have tried
... DynamicModule[{constrain, dots = {{.5, .5}}, dots1 = {{-.5, .5}}},
constrain = If[Norm[#] < 1, #, Normalize[#]] &;
LocatorPane[
Dynamic[{dots, (dots = constrain /@ #) &}, {dots1, (dots1 =
constrain /@ #) &}], Graphics[ ...
but syntax clearly isn't right. Not sure where to go from here.


{Do[b[i] = 1, {i, n}]}with{Do[b[i] = 1, {i, 10}]}should fix it. – kglr Jan 30 '21 at 20:36