inlined paperscript function