tanzen
to dance
To move rhythmically, usually to music, often as a social activity or art form.
Auf der Hochzeit haben wir bis in den Morgen getanzt.
At the wedding, we danced until morning.

to dance
Loading your saved state.
to dance
To move rhythmically, usually to music, often as a social activity or art form.
Auf der Hochzeit haben wir bis in den Morgen getanzt.
At the wedding, we danced until morning.

The perfect tense of 'tanzen' (to dance) is usually formed with 'haben' when it is about the activity itself. But when movement from one place to another is described, 'sein' is used.
Wir haben die ganze Nacht getanzt.
We danced the whole night.
'Tanzen' (to dance) can be used with different complements: you can dance a specific dance (accusative), dance with someone (preposition 'mit'), or dance to music (preposition 'zu').
Er hat auf der Feier einen Tango getanzt.
He danced a tango at the party.
In this meaning, 'tanzen' (to dance) is often used poetically for things that move lightly and irregularly. Typical subjects are leaves, snowflakes, flames, or reflections of light.
Die Blätter tanzten im Herbstwind.
The leaves danced in the autumn wind.
The idiom 'nach jemandes Pfeife tanzen' (to dance to someone's tune) is a fixed structure. The part 'jemandes' is often replaced by a possessive article (e.g., 'seiner') or a 'von + Dativ' construction.
Ich lasse mir nicht vorschreiben, was ich tun soll. Ich tanze nicht nach seiner Pfeife.
I won't let anyone tell me what to do. I don't dance to his tune.
to swing
'tanzen' and 'schwingen' can both describe a rhythmic movement. 'tanzen' is used mainly for people who move to music. Figuratively, something can also 'tanzen' lightly and irregularly, for example light or leaves. 'schwingen' more often means an even back-and-forth movement, for example with a swing or a pendulum. The words can be confused because both express movement and rhythm. When music and dance steps are important, 'tanzen' is more natural. When a movement goes back and forth regularly, 'schwingen' fits better.

Auf der Feier tanzten alle zu lauter Musik.
At the party, everyone danced to loud music.
Die Lampe schwingt leicht hin und her, weil das Fenster offen ist.
The lamp swings slightly back and forth because the window is open.