# lineRotate.py
from Processing import *
from math import *
window(500, 500)

# Some globals and settings
angle, dangle = 0.0, 0.01
strokeWeight(20)
stroke(0, 255, 0)

# Draw the line at the current angle
def rotate(o, e):
    global angle
    background(255)
    x1 = cos(angle)*200+250
    y1 = sin(angle)*200+250
    x2 = cos(angle + PI)*200+250
    y2 = sin(angle + PI)*200+250
    line(x1, y1, x2, y2)
    angle = angle + dangle

# Set up the loop
frameRate(10)
onLoop += rotate
#onMousePressed += rotate
loop()