rotating image implemented as Java Applet, in 1997
to a time when web browsers supported Applets in a proper way, and Flash or HTML5 wasn’t available.
for the output every pixel is calculated in realtime using a simple interpolation algorithm.
No big magic *

Code to embed the applet

[html] [/html] Applet Demo removed!! instead NOW this can be done with just some lines of javascript var ctx;var pixels;var shiftX=0;var shiftY=0;var w;var h;var len;var imageData;var ready;var texture;var imgData;var winkel=new Array();var radius=new Array();function init(){console.log(“init start”);w=document.getElementById(“game”).width;h=document.getElementById(“game”).height;ctx=document.getElementById(“game”).getContext(“2d”);pixels=ctx.createImageData(w,h);len=pixels.length;ctx.fillStyle=“rgb(200,0,0)";ctx.fillRect(10,10,55,55);var a=document.getElementById(“img1”);textureW=document.getElementById(“img1”).width;textureH=document.getElementById(“img1”).height;ctx.drawImage(a,0,0,textureW,textureH);imgData=ctx.getImageData(0,0,128,128);texture=imgData.data;for(var b=0;b<len;b++){pixels.data[b*4+3]=255}setInterval(clock,1000/100)}function clock(){render();ctx.putImageData(pixels,0,0)}function render(){var g=0;var d;var m=64/256+512/256*Math.sin(2*shiftX*Math.PI/(2*1024));var c=shiftX&511;var i=m*Math.sin(2*c*Math.PI/512);var a=m*Math.cos(2*c*Math.PI/512);var b=-a*(h/2);var e=i*(h/2);b-=i*(w/2);e-=a*(w/2);b+=64;e+=64;var l;var k;for(var f=0;f<h;f++){l=b;k=e;for(var j=0;j<w;j++){tposx=l&(textureW-1);tposy=k&(textureH-1);d=tposy*textureW+tposx;pixels.data[g++]=texture[d*4+0];pixels.data[g++]=texture[d*4+1];pixels.data[g++]=texture[d*4+2];pixels.data[g++]=255;l+=i;k+=a}b+=a;e-=i}shiftX+=2;shiftY-=2}window.onload=function(){init()};