Here is the fix

Use view.layer.transform instead of view.transform