You can replace uses of `lock()` with the Processing builtin `constrain()`.