A swaying skyscraper is not necessarily a failing one. In San Francisco, the pointed Transamerica Pyramid and rounded Salesforce Tower mark different architectural eras, but both stand in a city where the ground can move violently. That possibility makes controlled movement an asset, not a confession of weakness.
Rigidity has its price. When an earthquake shakes the ground, inertia resists changes in a building's motion, generating forces throughout its structure. A sufficiently rigid tower can attract large forces and suffer brittle damage; a flexible one can move with less force under some conditions. Ductility matters just as much: steel and reinforced concrete components can be detailed to deform beyond their elastic limits without immediately losing their ability to carry loads. Some of the earthquake's energy is dissipated through that deformation, though the resulting damage may require repair.
Movement is no free pass. Engineers must limit drift, the sideways displacement between floors, because excessive movement can damage walls, cladding and other building components. Damping devices can help dissipate energy, while structural systems and foundations are designed to carry forces safely into the ground. No tower is earthquake proof. Design choices depend on the building, the ground beneath it and the expected shaking; safety standards aim to reduce collapse risk, not guarantee an undamaged building. Against the sky, the towers appear still. Their strength lies partly in their permission to move.