How to add collision to 2d animation

In which the collider moves between frames

You can adjust collider properties while recording an animation. Press the red circle in the animation window and adjust your colliders frame by frame.