The creation and manipulation of multipartite entangled states is important for advancements in quantum computation and communication, and for testing our fundamental understanding of quantum mechanics and precision measurements. Multipartite entanglement has been achieved by use of various forms of quantum bits (qubits), such as trapped ions, photons, and atoms passing through microwave cavities. Quantum systems based on superconducting circuits have been used to control pair-wise interactions of qubits, either directly, through a quantum bus, or via controllable coupling. Here, we describe the first demonstration of coherent interactions of three directly coupled superconducting quantum systems, two phase qubits and a resonant cavity. We introduce a simple Bloch-sphere-like representation to help one visualize the unitary evolution of this tripartite system as it shares a single microwave photon. With careful control and timing of the initial conditions, this leads to a protocol for creating a rich variety of entangled states. Experimentally, we provide evidence for the deterministic evolution from a simple product state, through a tripartite W-state, into a bipartite Bell-state. These experiments are another step towards deterministically generating multipartite entanglement in superconducting systems with more than two qubits.