File:Moiré Uhr.gif
Moiré_Uhr.gif (500 × 500 pixels, file size: 1.22 MB, MIME type: image/gif, looped, 1,000 frames)
Note: Due to technical limitations, thumbnails of high resolution GIF images such as this one will not be animated. The limit on Wikimedia Commons is width × height × number of frames ≤ 100 million.
Captions
Summary
[edit]DescriptionMoiré Uhr.gif |
Deutsch: Moiré Uhr English: clock with Moiré effect Polski: Zegar z efektem Moiré |
|||
Date | ||||
Source | Own work | |||
Author | Idea: Dr.Ing.S.Wetzel (Uhr, Schiebelehre und eine Nonius-Uhr); Programmer:Benedikt.Seidl | |||
Other versions |
|
Quellcode
[edit]Die Einzelbilder des Gifs wurde mit einem Processing-1.0.1-Programm generiert, und anschließend mit Gifsicle zu einer Animation zusammengefügt. Der Befehl für Gifsicle wird am Ende des Programms ausgegeben. Davor müssen aber noch die ausgegebenen PNG-Bilder in Gifs umgewandelt werden.
int []oldpixels;
int []expixels;
int arg1=0;
PGraphics pg;
float j;
String s;
void setup()
{
size(500, 500);// P2D);
noStroke();
smooth();
strokeCap(SQUARE);
frameRate(10000); //as fast as it can
oldpixels = new int[width*height];
expixels = new int[width*height];
pg = createGraphics(width, height, JAVA2D);
}
void draw()
{
// zuerst hintergrund ganz ganz helle farbe machen (wird dann durchsichtig gemacht)
background(255,255,254);
//einen weißen kreis zeichnen (äußerster rand von der ganzen grafik)
fill(255);
stroke(0);
strokeWeight(width/250.0);
ellipse(width*0.5, height*0.5, height*0.95,width*0.95);
//einen schwarzen kreis zeichnen (inneres vom zifferblatt)
noStroke();
fill(0);
ellipse(width*0.5, height*0.5, height*0.9,width*0.9);
fill(255);
//die strichchen für die stunden zeichnen (der weiße rand vom zifferblatt wird noch einmal unterteilt)
stroke(0);
strokeWeight(height/100.0);
for(float i=1; i<=12 ; i++)
{
line(width*0.5 + width*0.951*0.5*cos(TWO_PI * i/12.0), width*0.5 + width*0.951*0.5*sin(TWO_PI * i/12.0), width*0.5 + width*0.89*0.5*cos(TWO_PI * i/12.0), width*0.5 + width*0.89*0.5*sin(TWO_PI * i/12.0));
}
noStroke();
//stunden-punkt zeichnen (der große weiße kreis)
ellipse(width*0.5 + (0.3 * width * cos(j-PI/2)), height*0.5 + (0.3 * height * sin(j-PI/2)), width/20, width/20);
//kleinen punkte zeichnen (hier werden 12 kleine weiße punkte gezeichnet)
for(float i=1; i<=12 ; i++)
{
ellipse(width*0.5 + ( 0.4 * width * cos(PI/2 + j + (TWO_PI * i/12.0))), height*0.5 + (0.4 * height * sin(PI/2 + j + (TWO_PI * i/12.0))), width/50.0, height/50.0);
}
// jetzt wieder teile davon verdecken
// jetzt wird über die kleinen weißen punkte ein schwarzer kreis gelegt, dieser hat aber genau 11 lücken und verdeckt damit immer
// einige der kleinen kreise
stroke(0,0,0);
strokeWeight(height/20.0);
noFill();
for(float i=1; i<=11 ; i++)
{
arc(width*0.5, height*0.5, width*0.8, height*0.8, i/11.0 * TWO_PI - PI/2 + atan(2*width/50.0 / (width*0.8) ), (i+1.0)/11.0 * TWO_PI - PI/2 - atan(2*width/50.0 / (width*0.8) ));
}
//jetzt ist das bild so weit fertig, jetzt laden wir es in den speicher
loadPixels();
//jetzt schauen wir uns jedes pixel des bildes an, und vergleichen es mit dem pixel des vorherigen bildes
for(int i=0; i < pixels.length; i++)
{
//wenn das pixel des vorherigen bildes gleich dem pixel des jetzigen bildes ist, macht es diesen punkt transparent bzw. wenn es nicht
// das erste bild ist, wenn das pixel die farbe 0,0,3 hat, wird es auch transparent siehe ganz am anfang mit dem background
if (((pixels[i] == oldpixels[i])&&(arg1 != 0))||(pixels[i]==color(255,255,254)))
expixels[i] = color(0,0,0,0);
//wenn es nicht transparent ist, macht es es in der farbe, in der das aktuelle bild ist.
else
expixels[i] = pixels[i];
}
arg1 ++;
//jetzt wird das bild, das gerade errechnet wurde, gespeichert
arrayCopy(pixels,oldpixels);
pg.beginDraw();
pg.loadPixels();
arrayCopy(expixels, pg.pixels);
pg.updatePixels();
pg.save(""+arg1+".png");
pg.endDraw();
//hier tickt die zeit
if(j <= TWO_PI)
j = j + PI/500;
else
{
println("der erste teil der animation ist geschafft. jetzt die pngs in gif umwandeln und dann folgenden befehl ausführen:");
println(""); //leerzeile
s = "";
for (int i = 1; i<=1000;i++)
s = s + " "+i+".gif";
print("gifsicle -l -d 0 -D asis "+s+" >animation.gif");
noLoop(); // hier endet das programm
}
}
Licensing
[edit]Public domainPublic domainfalsefalse |
I, the copyright holder of this work, release this work into the public domain. This applies worldwide. In some countries this may not be legally possible; if so: I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law. |
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 07:51, 9 January 2009 | 500 × 500 (1.22 MB) | Benedikt.Seidl (talk | contribs) | {{Information |Description={{de|1=Moiré Uhr}} |Source=Eigenes Werk (own work) |Author=Benedikt.Seidl |Date=2008-01-09 |Permission= |other_versions= }} <!--{{ImageUpload|full}}--> Category:Moiré |
You cannot overwrite this file.
File usage on Commons
The following 2 pages use this file:
File usage on other wikis
The following other wikis use this file:
- Usage on de.wikipedia.org