我做了叶序效应。你知道吗
工作原理如下:
我想要达到的目标。你知道吗
N步。第N个循环。你知道吗
N+1步。对N点进行计算
N+2步。得到X和Y的值
N+3步。使用一次迭代中的值X和Y打印点。你知道吗
这是我的密码:
from kivy.graphics import *
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ListProperty, ObjectProperty
from kivy.graphics.vertex_instructions import (Rectangle, Ellipse, Line
import math
n = 0
c = 5
class PhyllotaxiswApp(App):
def build(self):
return boxOustide()
class boxOustide(BoxLayout):
def __init__(self):
super(boxOustide, self).__init__()
with self.canvas:
global n
global c
window_center_x = self.get_center_x() * 8
window_center_y = self.get_center_y() * 6
post = c * 3500
for i in range(15200):
a = n * 137.3
r = c * math.sqrt(n)
x = r * math.cos(a) + window_center_x
y = r * math.sin(a) + window_center_y
Color(n % .999, .999, .999, mode='hsv')
Ellipse(pos=(x, y), size=(5, 5))
n += 1
if __name__ == "__main__":
PhyllotaxiswApp().run()
编辑1
好吧,在我发现这个之后,现在有一扇巨大的窗户为我打开了:
Clock.schedule_interval(class.function,1 / 60)
你试过用kivy中的时钟对象实现它吗。?你知道吗
相关问题 更多 >
编程相关推荐