I am completely new to processing.js and wanted to make a sketch for my portfolio website. I made a skech using
fisica, only to later find out that external libraries such as fisica are not supported in processing.js. And this is a problem. Luckily fisica is a port for processing from the popular
box2d physics, and a
port for javascript exists as well!
Unfortunately, I am very unexperienced in javascript, and although my numerous google searches have resulted in some examples of processing.js working with box2d.js (
here and
here ), I have absolutely no idea how to change my code to utilize box2d.js to get it to work in a browser...
This question links to
a tutorial on the processingjs.org website, which unfortunately does not work anymore...
Is there anyone who can help me out to a good start?
Kind regards,
Nikolai
This is my code:
import fisica.*;
FWorld world;
PFont font;
ArrayList<Competency> competencies = new ArrayList<Competency>();
ArrayList<LearningActivity> learningActivities = new ArrayList<LearningActivity>();
Like many, I have trouble with making a timer using Processing. I have searched the forum, but could not find an answer that suited my question. (I am quite new to Processing)
I am making a kinect application, and I want to create a button that you can trigger by holding one of your hands over it for two seconds. I have made the following function that checks wether your hand overlaps a specified target area (this is not really important, but good for knowing the context):
Now I want to make a check wether the above function is triggered for two seconds without interruption. (Later, I want to accompany that with some visual feedback of this timer-event):
if (handOverlapCheck(menuButtonX, menuButtonY, menuButtonWidth, menuButtonHeight) == true)
{
// magic check wether this event happens for 2 seconds
backgroundLevel = 3;
}
All I can think of is something along the lines of the following:
if (handOverlapCheck(menuButtonX, menuButtonY, menuButtonWidth, menuButtonHeight) == true)
{
int newTimer = millis();
if (mills() - newTimer = 2000)
{
backgroundLevel = 3;
}
}
But, obviously this won't work, since this keeps updating the newTimer value to the current time. All the variations that I can think of do this.
And now I find myself thinking in circles... Could someone please help me in a forward direction?