function* rotate() {
const context=createContext(image)
let input=context.getImageData(0, 0, width, height)
let output=context.createImageData(width, height);
let raw=[], count=0, Kj=0
const alpha=0.0001
while (count<5000) {
for (let y=1; y<height-1; ++y) {
for (let x=1; x<width-1; ++x) {
let i=(y*width+x)*4
let rgb=[0,0,0]
for (let c=0; c<3; c++) {
for (let j=0; j<9; j++) {
let ii=i+(j%3-1)*4+width*((j-j%3)/3-1)*4
Kj=Kx[j]*(y-height/2)-Ky[j]*(x-width/2)
rgb[c]+=(count==0)?input.data[ii+c]*alpha*Kj:raw[ii+c]*alpha*Kj
}
raw[i+c]=(count==0)?input.data[i+c]+rgb[c]:raw[i+c]+rgb[c]
output.data[i+c]=Math.round(raw[i+c])
}
output.data[i+3]=255;
}
}
context.putImageData(output, 0, 0);
yield context.canvas;
count++
for (let x=1; x<width-1; x++) {
let i=x*4
for (let c=0; c<3; c++)
raw[i+c]=raw[i+c+width*4]
i+=width*(height-1)*4
for (let c=0; c<3; c++)
raw[i+c]=raw[i+c-width*4]
}
for (let y=0; y<height; y++) {
let i=y*width*4
for (let c=0; c<3; c++)
raw[i+c]=raw[i+c+4]
i+=(width-1)*4
for (let c=0; c<3; c++)
raw[i+c]=raw[i+c-4]
}
}
}