Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skulpt processing translate function #775

Open
technisculpt opened this issue Apr 8, 2018 · 0 comments
Open

skulpt processing translate function #775

technisculpt opened this issue Apr 8, 2018 · 0 comments

Comments

@technisculpt
Copy link

technisculpt commented Apr 8, 2018

Hi,
i don't think the translate function is working as intended, trying to run some code here: http://www.skulpt.org/static/proctest.html

If you hit run on the following code it will work but if you hit run again it will break and require a page refresh:

from processing import *
from math import sin, cos

global angle
angle = 0

def setup():
	size(250, 250)

def draw():
	global angle
	background(220)
	translate(environment.width/2, environment.height/2)
	line(0, 0, 100*cos(angle), 100*sin(angle))
	angle += 0.03
run()

whereas the following code will work repeatedly (doesn't use the translate function):

from processing import *
from math import sin, cos

global angle
angle = 0

def setup():
	size(250, 250)

def draw():
	global angle
	background(220)
	line(environment.width/2, environment.height/2, environment.width/2+100*cos(angle), environment.height/2+100*sin(angle))
	angle += 0.03
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant