当前位置:网站首页>Processing polyhedron change
Processing polyhedron change
2022-06-26 13:05:00 【Harmony between man and nature Peng】
SimpleFrom.py
class Form:
def __init__(self, x, y, r): # Constructor
self.x = x; self.y = y # Set x and y position
self.rad = r # Set radius
self.x_speed = random(-2, 2) # Set random x speed
self.y_speed = random(-2, 2) # Set random y speed
# self.x_speed = random(-10, 10) # Set random x speed
# self.y_speed = random(-10, 10) # Set random y speed
def update_me(self):
self.x = (self.x + self.x_speed) % width # Moves x and wrap
self.y = (self.y + self.y_speed) % height # Moves y and wrap
def draw_me(self):
stroke(200)
point(self.x, self.y) # Draw a dot
noStroke(); fill(200,50)
ellipse(self.x, self.y, self.rad, self.rad) # Draw a circle
def line_to(self, other):
stroke(200)
line(self.x, self.y, other.x, other.y)function
from SimpleForm import Form
def setup():
size(600, 600)
background(50)
global forms
forms = []
for i in range(10):
starting_x = width/4 * random(1, 3)
starting_y = height/4 * random(1, 3)
forms.append(Form(starting_x, starting_y, 10))
def draw():
background(50) # Clear the screen each time
for i in range(len(forms)):
forms[i].update_me() # Update the position of each
for a in range(len(forms)):
for b in range(len(forms)):
if a > b: # Prevents lines drawing twice
forms[a].line_to(forms[b])
边栏推荐
- This function has none of deterministic, no SQL solution
- Sharing ideas for a quick switch to an underlying implementation
- 【Spark】.scala文件在IDEA中几种图标的解释
- Vivado 错误代码 [DRC PDCN-2721] 解决
- What should the software test report include? Interview must ask
- UVA10341 solve it 二分
- P2393 yyy loves Maths II
- Go 结构体方法
- National standard gb28181 protocol easygbs video platform TCP active mode streaming exception repair
- Electron official docs series: References
猜你喜欢
![[极客大挑战 2019]RCE ME 1](/img/66/e135f7e5a7cbdeb5b697f3939a3402.png)
[极客大挑战 2019]RCE ME 1
微信小程序测试点总结
![[esp32-c3][rt-thread] run RT-Thread BSP minimum system based on esp32c3](/img/4a/503240b332e3279047c438f1d9845e.png)
[esp32-c3][rt-thread] run RT-Thread BSP minimum system based on esp32c3

倍福通过CTU和TON实现时间片大小和数量的控制

goto语句实现关机小程序

倍福PLC通过程序获取系统时间、本地时间、当前时区以及系统时间时区转换

Electron official docs series: Get Started

Processsing mouse interactive learning

processing 函数translate(mouseX, mouseY)学习

P2393 yyy loves Maths II
随机推荐
G - Cow Bowling
轻流完成与「DaoCloud Enterprise 云原生应用云平台」兼容性认证
国标GB28181协议EasyGBS视频平台TCP主动模式拉流异常情况修复
HDU 5860
First knowledge - Software Testing
Beifu PLC passes MC_ Readparameter read configuration parameters of NC axis
中国剩余定理模板题 互质与非互质
Guacamole installation
详细讲解C语言10(C语言系列)
Analysis and protection of heart blood dripping vulnerability (cve-2014-0160)
Explain C language 11 in detail (C language series)
F - Charm Bracelet
ES6模块
【网络是怎么连接的】第二章(下):一个网络包的接收
Biff TwinCAT can quickly detect the physical connection and EtherCAT network through emergency scan
HDU1724[辛普森公式求积分]Ellipse
Goto statement to realize shutdown applet
goto语句实现关机小程序
Photoshop 2022 23.4.1增加了哪些功能?有知道的吗
Chapter 01_ Installation and use of MySQL under Linux