Text Size
Text Size
Exit Full Screen
Python Mini
Show
Source Code
View Source Code in Full Screen
Open in New Tab
from processing import * wt = 500 ht = 600 b = { "xp" : 50, "yp" : 50, "xh" : 4, "yh" : 2, "rad" : 10 } def drawB(): fill(255, 255, 255) ellipse(b["xp"], b["yp"], (b["rad"]*2), (b["rad"]*2)) def moveB(): b["xp"] = b["xp"] + b["xh"] b["yp"] = b["yp"] + b["yh"] if (b["xp"] + b["rad"]) >= wt or (b["xp"] - b["rad"]) <= 0: b["xh"] = b["xh"] * -1 if (b["yp"] + b["rad"]) >= ht or (b["yp"] - b["rad"]) <= 0: b["yh"] = b["yh"] * -1 #:::::::::::::THE PROCESSING PACKAGE::::::::::::::::::::::::::::: def setup(): size(wt, ht) background(0, 0, 0) def draw(): drawB() moveB() run()
ch_BallTrace.py
( around 28 lines python code )
Published By:
EM5700
Published on
2020-02-25T13:56:57Z
Python Mini
- an
OYOclass
application,
own your own class today
.
Run
Result
×
Error message shows here