Uses the “if.. else” method to start or stop an expression at specified times.
Code Sample
Hover over the code and click the copy button.
// To start an expression at a given time
timeToStart = 2; // or at whatever time you prefer
if (time > timeToStart) {
wiggle(3,25); // or whatever expression you prefer
} else {
value;
}
//To stop an expression at a given time:
timeToStop = 4; // or at whatever time you prefer
if (time > timeToStop) {
value;
} else {
wiggle(3,25);
}
//To control both start and stop times:
timeToStart = 2;
timeToStop = 4;
if ((time > timeToStart) && (time < timeToStop)) {
wiggle(3,25);
} else {
value;
}
// Note that you don't have to create the timeToStart and timeToStop variables, but can insert your times directly into the function.