The current code was going into an infinite loop It's also setting `patternUnits` to `userSpaceOnUse` in order to get the same behaviour as canvas patterns