Alternating currents (AC) are produced by an AC generator, which consists of a wire that rotates in a magnetic field created by magnets. As the wire rotates in the magnetic field, it cuts through the magnetic flux lines. The changing magnetic flux through the wire generates a force (electromotive force) that drives the electric charges around the wire. The circulating conducting wire creates an oscillating electric current flowing in two directions depending on the varying polarity of the magnet.