# How to combine bumps and dimples?

I'm working on a set of diagrams to try to make interesting math activities for positive and negative integers. These diagrams look like this. (This diagram would represent 4-3=1. Later, I'll test this out to see if students actually see it this way.)

What I'd like to do is to create animations where the bumps and dimples combine and become a 'flat' surface.

My first attempt is just to have gray in the overlap zone, which isn't too bad. What I'd like is to have the overlap zone more gradually transition from the bump through to the dimple.

Here's the basic Mathematica code I used to create these images.
Unit[θ_] := {Cos[θ], Sin[θ]}

Dimple[r_, ϕ_] := Translate[Polygon[Table[Unit[θ], {θ, 0, 360*Degree,
(360*Degree)/80}], VertexColors -> Table[Blend[{White, Black}, (1 + Sin[θ])/2], {θ, 0,
360*Degree, (360*Degree)/80}]], r*Unit[ϕ]]

Bump[r_, ϕ_] := Translate[Polygon[Table[Unit[θ], {θ, 0, 360*Degree,
(360*Degree)/80}], VertexColors -> Table[Blend[{Black, White}, (1 + Sin[θ])/2], {θ, 0,
360*Degree, (360*Degree)/80}]], r*Unit[ϕ]]

OverLapTable[d_] := Join[Table[Unit[θ] - {d, 0}, {θ, -ArcCos[d], ArcCos[d], 0.01}],
Table[Unit[θ] + {d, 0}, {θ, 180*Degree - ArcCos[d], 180*Degree + ArcCos[d], 0.01}]]

Graphics[{Gray, Rectangle[{-2, -2}, {2, 2}], Bump[0.5, 0], Dimple[0.5, 180*Degree], Gray,
Polygon[OverLapTable[0.5]]}]


This sort of a side view of what I'm hoping to accomplish, with a smooth transition between the dimple and the bump.

• Thanks for cleaning up the code, wuyud! I didn't know how to do that. – David Elm Dec 21 '20 at 4:37

One can try Opacity:
Graphics[{{Gray, Rectangle[{-2, -2}, {2, 2}]}, {Opacity[0.9], 