'Can't assign to function call/curve not showing
I'm currently writing a Python Processing code where I need to animate a curve with equations defined as X(t) and Y(t). However, I keep getting the "can't assign to function curve" error. I tried writing the equations without the X(t) and Y(t) (which fixed the error), but no line is shown animating on my screen- it's just blank. Do I need to fix my window size? I'm new to coding and can't figure out for the life of me what's wrong. Any help is much appreciated (code shown below)
from coordsys import *
class Point:
def __init__(self, theX, theY):
self.x = theX
self.y = theY
# constructor with initializations
# functions to calculate x and y
def calculateX(t):
X(t) = t - 2
return t
def calculateY(t):
Y(t) = (t - 2)**2
return 0
def setup():
global t, ptlist
size(600, 600)
colorMode(RGB, 1.0, 1.0, 1.0)
stroke(1.0, 1.0, 0.4)
fill(0.4, 0.4, 1.0)
t = 0.0
ptlist = []
# initialize time step, point list
def draw():
global t, ptlist
# set up coordinate frame, line weight, background
coordinateFrame(-1.0, -1.0, 1.0, 1.0)
borderWeight(3)
background(0.25, 0.0, 0.1)
xCoordinate = calculateX(t)
yCoordinate = calculateY(t)
myPoint = Point(xCoordinate, yCoordinate)
ptlist.append(myPoint)
print(ptlist)
t += 0.1
if t > 2.0:
noLoop()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
