It is a long program, each a few micro seconds changes a picture with another one. Each new picture is slightly different from the last one. Because the pictures change quickly you feel a sense of continuals movement. The picture you see with President Obama is not spinning, but changes picture after picture a bit quickly. So you feel it is spinning.

The loughing picture on the left works on the same principle. It is made up of many pictures, change from one to another to give the sense of loughing. This has nothing to do with IQ. It is the question of learning to right the program and know the trick of it.
Bellow is a javascript I wrote to change back ground collour from white to purple and back to white. Every 1000 microseconds, changes to a new colour 32 times from white to purple.Possibly 32 times could do the same thing with Kurdistan flag. For that either you make 32 Kurdistan flags with the position of sunrays a bit moved clockwise for each next one or you just make 32 pictures of the sun, the rays of each next one moved clockwise abit. You have to adjust the position of the sun in the middle of one flag. But it is a lot easier to make 32 complete flags.
The following is the script without HTML:
function run_backGrounds()
{
setTimeout("changeBackgrounds()",1000);
}
function changeBackgrounds()
{
backGroundCounter++;
if (backGroundCounter < numberOfBackGrounds)
{
setTimeout("changeBackgrounds()",1000);
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
if (backGroundCounter == 1)
{
document.bgColor="white";
}
if (backGroundCounter == 2)
{
document.bgColor="#ffffee";
}
if (backGroundCounter == 3)
{
document.bgColor="#ffeeee";
}
if (backGroundCounter == 4)
{
document.bgColor="#ffddee";
}
if (backGroundCounter == 5)
{
document.bgColor="#ffccee";
}
if (backGroundCounter == 6)
{
document.bgColor="#ffbbee";
}
if (backGroundCounter ==7)
{
document.bgColor="#ffaaee";
}
if (backGroundCounter ==

{
document.bgColor="#ff99ee";
}
if (backGroundCounter == 9)
{
document.bgColor="#ff88ee";
}
if (backGroundCounter == 10)
{
document.bgColor="#ff77ee";
}
if (backGroundCounter == 11)
{
document.bgColor="#ff66ee";
}
if (backGroundCounter == 12)
{
document.bgColor="#ff55ee";
}
if (backGroundCounter == 13)
{
document.bgColor="#ff44ee";
}
if (backGroundCounter == 14)
{
document.bgColor="#ff33ee";
}
if (backGroundCounter == 15)
{
document.bgColor="#ff22ee";
}
if (backGroundCounter == 16)
{
document.bgColor="#ff11ee";
}
if (backGroundCounter == 17)
{
document.bgColor="#ff00ee";
}
if (backGroundCounter == 18)
{
document.bgColor="#ff11ee";
}
if (backGroundCounter == 19)
{
document.bgColor="#ff22ee";
}
if (backGroundCounter == 20)
{
document.bgColor="#ff33ee";
}
if (backGroundCounter == 21)
{
document.bgColor="#ff44ee";
}
if (backGroundCounter == 22)
{
document.bgColor="#ff55ee";
}
if (backGroundCounter == 23)
{
document.bgColor="#ff66ee";
}
if (backGroundCounter == 24)
{
document.bgColor="#ff77ee";
}
if (backGroundCounter == 25)
{
document.bgColor="#ff88ee";
}
if (backGroundCounter == 26)
{
document.bgColor="#ff99ee";
}
if (backGroundCounter == 27)
{
document.bgColor="#ffaaee";
}
if (backGroundCounter == 28)
{
document.bgColor="#ffbbee";
}
if (backGroundCounter == 29)
{
document.bgColor="#ffccee";
}
if (backGroundCounter == 30)
{
document.bgColor="#ffddee";
}
if (backGroundCounter == 31)
{
document.bgColor="#ffeeee";
}
if (backGroundCounter == 32)
{
document.bgColor="#ffffee";
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
if (backGroundCounter == 32)
{
run_backGrounds();
backGroundCounter = 0;
}
}
</script>