Ducks are ectothermic animals, which means their body temperature depends on the environment. When you pet a duck, you are providing her with warmth. This causes her body to heat up and she will shake in order to cool down.