from math import sin
from processing import *
X = 30
Y = 30
delay = 16
radius = 30
def setup():
strokeWeight(10)
frameRate(20)
size(500,500)
def sircle():
global X, Y, radius
background(100)
fill(0,121,184)
stroke(255)
fc = environment.frameCount
X += (mouse.x-X)/delay;
Y += (mouse.y-Y)/delay;
radius = radius + sin(fc / 4)
draw = sircle
run()
出于某种原因run()
只会创建背景。
有人知道如何调用sircle()
的函数吗
我认为OP指的是this code
其中
draw
被赋值为函数变量sircle
似乎是正确的。此外,它不像sircle()
返回任何可以分配给draw
的内容查看我在上面共享的链接中的示例代码,您需要一行
在
sircle
函数的末尾您需要使用括号运行
sircle()
和setup()
这些函数不是变量,它们需要括号。在代码中
draw
变量存储sircle()
函数的内存地址相关问题 更多 >
编程相关推荐