Ich werfe kleine Steinchen auf das Fenster, eins nach dem anderen.
Ich werfe kleine Steinchen gegen das Fenster, eins nach dem anderen.
I am throwing small stones at window one after the other.
"Auf" in combination with throwing means either "on top of" or "toward" without implication of hitting.
Ich werfe meinen Hut auf mein Bett.
Ich werfe einen Schneeball auf dich.
"Gegen" means against and does imply hitting. "An" is also possible. That would be less aggressive... you'd do that to get your loves attention. "Gegen" would sound out of place right there.
Ich werfe kleine Steinchen auf das Fenster, eins nach dem anderen, means over (or toward) the window (and missing).
Ich werfe kleine Steinchen gegen das Fenster, eins nach dem anderen, means against the window (and hitting).