exactly what Carlton said, it is a defensive posture. it is best to leave the cham be right away, or just be still and move very slowly to reduce stress or freight.
if a chameleon gets scared, it can run away very quickly through the branches, or just run into nothing fall and really hurt itself.