New answers tagged

0

The error message is telling you that you've got a stray bracket, so count your brackets and see if the (s match the )s. Spoiler alert: they don't. I can see two cases: after each linear function call you have a closing bracket after the "Null 1" string that isn't matched by an opening bracket. And "Null 1" on its own is just treated as a string, not a ...


0

You just need to check if the nearest marker is in the past or the future. If it's in the future, just subtract 1 from its index. This avoids the use of a loop. if (marker.numKeys > 0) { nearestMarker = marker.nearestKey(time); if (nearestMarker.time > time){ nearestMarker.index - 1; } else { nearestMarker.index; } } ...


0

marker.nearestKey picks the closest marker - even if it is in the future. A simple solution would be to iterate over the markers with a for loop instead: if (marker.numKeys > 0) { let i; for (i = 0; i < marker.numKeys; i++) { // For every marker we have, add 1 to i if (marker.key(i+1).time > time) // If the marker is past ...


Top 50 recent answers are included