1. Create "pin" and set its origin to its bottom
2. duplicate your pin in ANY way/order you want (tho if you need it to be NON planar, try applying that deformation at end)
3. RENAME pin objects to watever name but with incremental sufix like : pin_obj1, pin_obj2 ... pin_obj9999
4. select all pins and run script (your dis_mesh will be generated now which is used to drive pins scaleY)
5. now create plane (it must "include"/"cover" all pins) also create whatever objects you want to be "shaped" with pins,
and COMBINE THEM (plane + animated objects)
6. move "dis_mesh" above highest point of your animated objects
7. select new combined object , then select "dis_mesh" and Transfer Attributes with "vertex position" ON, " world space" selected AND "search method "closest along normal" (this is very important)
8. just hide combined object and "dis_mesh" now and enjoy results.
You can also get interesting results by turning dis_mesh to soft body adding fields to it or just make it interact with environment.
try to change expression to drive different attributes like rotation or scale to achive totaly different kind of effect.
This is most probably the best way to create this (exept creating a plugin), it handles really a LOT of objects in real time its
fully customizable and probably 10 times faster then doing the same with animated texture (displacement-like) plus this way you dont need to prerender textures etc ... you can allways do tweeks to animated objects and instantly see results.