0

I need to upload my processing sketch to my website in order for it to be assessed as part for my mark. But the code doesn't work when I use it online.

It can be found at: http://sketchpad.cc/16tzxgxy6w (not working) but if you copy that code to Processing and run it, works perfectly.

this is the main bit if anyone can recosnise an issue - basically drawing a random shape w/ points based on simple math.

for(int i = 0; i < points; i++)
  {
     stroke(strokeCol); 
     fill(backgroundCol); 
     float startX = sin(radians(startDot * dotDegree)) * radius;
     float startY = cos(radians(startDot * dotDegree)) * radius;

     float endX = sin(radians(endDot * dotDegree)) * radius;
     float endY = cos(radians(endDot * dotDegree)) * radius;


     line(startX, startY, endX, endY);
     ellipse(startX, startY, eSize, eSize);

     startDot = endDot;
     endDot = int(random(points));

  }       

Thank a lot for any suggestions.

2
  • 2
    Open your browser debugger (usually F12) - "Uncaught TypeError: stroke is not a function" Commented Jan 22, 2016 at 17:01
  • @JamesThorpe Exactly what it says - I'll look at how to resolve that, thanks! Commented Jan 22, 2016 at 17:08

1 Answer 1

1

Basically, in the Sketchpad provided, you override the Processing stroke function with a variable, storing a number in it (that's why you got the error James Thorpe commented on).

I changed a bit your Sketchpad, changing this lines

int strokeValue = 7; // instead of stroke
int eSize = strokeValue*3;

and later

strokeWeight(strokeValue);

Then, stroke is still a function when you use it in the script and it finally renders something.

I'm sorry I don't know how to 'fork' a Sketchpad...

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much! Just tabbed back in to the sketch pad to see it ticking through. Much appreciated,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.