kopia lustrzana https://github.com/villares/sketch-a-day
Update sketch_2020_04_03a.pyde
rodzic
3ba61d5c68
commit
1fbcd89f56
|
|
@ -21,15 +21,13 @@ permitDrag = [False] * 4
|
||||||
def setup() :
|
def setup() :
|
||||||
size(300, 300)
|
size(300, 300)
|
||||||
smooth()
|
smooth()
|
||||||
# startpocoordinates
|
# startpoint coordinates
|
||||||
x[0] = x[1] = 50
|
x[0] = x[1] = 50
|
||||||
y[0] = 50
|
y[0] = 50
|
||||||
y[1] = y[2] = 150
|
y[1] = y[2] = 150
|
||||||
x[2] = x[3] = 250
|
x[2] = x[3] = 250
|
||||||
y[3] = 250
|
y[3] = 250
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def draw() :
|
def draw() :
|
||||||
background(255)
|
background(255)
|
||||||
noFill()
|
noFill()
|
||||||
|
|
@ -51,32 +49,26 @@ def draw() :
|
||||||
else:
|
else:
|
||||||
fill(0)
|
fill(0)
|
||||||
ellipse(x[i], y[i], 5, 5)
|
ellipse(x[i], y[i], 5, 5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# permit dragging
|
# permit dragging
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
if permitDrag[i]:
|
if permitDrag[i]:
|
||||||
x[i] = mouseX
|
x[i] = mouseX
|
||||||
y[i] = mouseY
|
y[i] = mouseY
|
||||||
|
|
||||||
|
|
||||||
def mouseReleased () :
|
def mouseReleased () :
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
permitDrag[i] = False
|
permitDrag[i] = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def mousePressed () :
|
def mousePressed () :
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
if (x[i]-5 <= mouseX <= x[i]+10 and
|
if (x[i]-5 <= mouseX <= x[i]+10 and
|
||||||
y[i]-5 <= mouseY <= y[i]+10):
|
y[i]-5 <= mouseY <= y[i]+10):
|
||||||
permitDrag[i] = True
|
permitDrag[i] = True
|
||||||
|
|
||||||
# hand curser when over dragging over points
|
# hand cursor when over dragging over points
|
||||||
def mouseMoved () :
|
def mouseMoved () :
|
||||||
cursor(ARROW)
|
cursor(ARROW)
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
if (mouseX>=x[i]-5 and mouseX<=x[i]+10 and mouseY>=y[i]-5 and mouseY<=y[i]+10) :
|
if (x[i]-5 <= mouseX <= x[i]+10 and
|
||||||
|
y[i]-5 <= mouseY <= y[i]+10):
|
||||||
cursor(HAND)
|
cursor(HAND)
|
||||||
|
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue