It depends on state law. In MD (where I'm most familiar with exactly what the law is) as long as the light is either green or yellow when you enter the intersection, then you're legal to continue on through. If the light is red at the instant you enter the intersection, that's a violation.I could be wrong (I was once) but I believe ours are set that if the light turns red and you are in the intersection, you are nailed.
Other states have different statutes.