help with shadow block

So, I was making a block for image shadow but if you type a input higher than 90, the code crops the image and still scale the sprite size.
Here’s the code:

   //% block="shadow $img|with color: $c|length: $leng|rotation: $rot"
    //% c.shadow="colorindexpicker"
    //% inlineInputMode=inline
    //% subcategory="Image"
    //% img.shadow="screen_image_picker"
    //% subcategory="Image"
    export function shadow(img: Image, c: number, leng: number, rot: number) {
        let picture = image.create(image.getDimension(img, image.Dimension.Width) + (leng + 1), image.getDimension(img, image.Dimension.Height) + (leng + 1))
        let clone = img.clone()
    for (let index = 0; index <= leng; index++) {
        picture.drawTransparentImage(CyberScripts.OneColorImage(img, c), index * Math.sin(rot * (Math.PI / 180)), index * Math.cos(rot * (Math.PI / 180)))
    }
    picture.drawTransparentImage(clone, 0, 0)
    return picture
    }