I don't know what you are thinking of in the way of grammatical 'rules'. They are composed rather artificially, but they agree with correct sentence structure. Neither is likely to appear as a real utterance. A native speaker would probably use this: When I'm walking on the road, I can see the stars twinkling.