Grazie KillerWorm per le dettagliate, chiare e approfondite spiegazioni.
Bisognava definire
let img = new Image();
a livello globale per potere utilizzare l'immagine anche nella funzione ritaglia(), che quindi si riduce al codice sottostante
lanvoel
codice:function ritaglia() { var oix1=document.getElementById('oix').value; var oiy1=document.getElementById('oiy').value; var lx1=document.getElementById('lx').value;var ay1=document.getElementById('ay').value; var oidx1=document.getElementById('oidx').value; var oidy1=document.getElementById('oidy').value; var ldx1=document.getElementById('ldx').value; var ady1=document.getElementById('ady').value; crtx.drawImage(img,oix1,oiy1,lx1,ay1,oidx1,oidy1,ldx1,ady1);// immagine ritaglio }

Rispondi quotando