Tantalum oxynitride thin films are deposited by radio-frequency magnetron sputtering using a pure tantalum target under argon/oxygen/nitrogen gas mixture. The argon flow is kept constant while the oxygen and nitrogen flows are changed simultaneously in a way to keep constant the total flow of these reactive gases. We succeed to deposit TaOxNy films with stoichiometry ranging between those of TaN and Ta2O5. All films are deposited at room temperature and are amorphous. Spectroscopic ellipsometry and UV-visible spectrometry investigations show a direct relation between the optical properties and the stoichiometry of the films. In particular, the results show a variation of the refractive index from pure tantalum nitride-like films (3.76) to tantalum pentoxyde-like films (2.1), which confirms the possibility to deposit graded antireflective coatings with tantalum oxynitride.