Drehkreise
Diese Animation hatt ich schonmal mit Adobe Flash gebaut, aber da es auch Open Source Compiler gibt ...
Zum Beispiel haXe, was es für Windows und Linux gibt. Ist ein bissel wie Java mit ActionScript drin.
Hier drunter ist der Quelltext für die Animation. Wie man einen Kreis aus Splines Zeichnet hab ich aus nem Forum.
Man klicke auf das blaue Viereck.
import flash.MovieClip; class Drehkreise { static var mc : MovieClip; static var scheiben : Scheiben; static function main() { scheiben = new Scheiben(); mc = flash.Lib.current; var button = mc.createEmptyMovieClip ("button", mc.getNextHighestDepth()); button.beginFill(0x234090,20); button.moveTo(180,105); button.lineTo(180,145); button.lineTo(220,145); button.lineTo(220,105); button.endFill(); button.onRelease = scheiben.neu; mc.onEnterFrame = scheiben.drehen; } } // class Drehkreise class Scheiben { private var mc : MovieClip; private var scheibe : Array<MovieClip>; private var geschwindigkeit : Array<Float>; public function new() { // constructor mc = flash.Lib.current; var anzahlderkreise = 24; scheibe = new Array(); geschwindigkeit = new Array(); for( i in 0...anzahlderkreise ) { scheibe[i] = mc.createEmptyMovieClip ("scheibe"+i, mc.getNextHighestDepth()); malen(scheibe[i]); scheibe[i]._rotation = (360/anzahlderkreise)*i; //startwinkel geschwindigkeit[i] = Math.random()*1.5 -0.75; } } // new public function neu() { // Scheiben loeschen und neue malen for( i in 0...scheibe.length ) { scheibe[i].removeMovieClip(); } var anzahlderkreise = Math.round(Math.random()*20 +15); // trace(anzahlderkreise); for( i in 0...anzahlderkreise ) { scheibe[i] = mc.createEmptyMovieClip ("scheibe"+i, mc.getNextHighestDepth()); malen(scheibe[i]); scheibe[i]._rotation = (360/anzahlderkreise)*i; //startwinkel geschwindigkeit[i] = Math.random()*1.5 -0.75; // um wieviel Grad sich scheibe[i] pro Frame dreht } } // neu private function malen( scheibe : MovieClip ) { scheibe.beginFill(0x234090,Math.random()*2+5); var segmente = 10; // bestimmt, in wievielen Schritten jede Scheibe gemalt wird var radius = Math.random()*100+100; // aussenradius var angle = (Math.random()*135+45) /segmente/180*Math.PI; // Winkel des Kreisbogens durch anzahl der Segmente var ctrlR = radius / Math.cos(angle / 2); var winkel = 0.0; // jeweils der aktuelle Winkel var px = Math.cos(winkel) * radius; var py = 0.0;// Math.sin(winkel) * radius; scheibe.moveTo(px, py); // an dem Punkt wird angefangen zu zeichnen var s = 0; while (s < segmente) // aussenkreis { winkel += angle; var winkelHalb = winkel - angle / 2; var cx = Math.cos(winkelHalb) * ctrlR; var cy = Math.sin(winkelHalb) * ctrlR; px = Math.cos(winkel) * radius; py = Math.sin(winkel) * radius; scheibe.curveTo(cx, cy, px, py); s++; } radius -= Math.random()*radius; // innenradius if (radius < 45) radius+=45; // mindestinnenradius ( darf nicht groesser sein als aussenradius/2 ) ctrlR = radius / Math.cos(angle / 2); px = Math.cos(winkel) * radius; py = Math.sin(winkel) * radius; scheibe.lineTo(px, py); // gerade kante vom Aussenbogen zum Innenbogen s = segmente-1; while ( s >= 0 ) // innenkreis { winkel -= angle; var winkelHalb = winkel + angle / 2; var cx = Math.cos(winkelHalb) * ctrlR; var cy = Math.sin(winkelHalb) * ctrlR; px = Math.cos(winkel) * radius; py = Math.sin(winkel) * radius; scheibe.curveTo( cx, cy, px, py); s--; } scheibe.endFill(); scheibe._x = 200; // Mittelpunkt der Kreise/des Flashfilmes scheibe._y = 125; } // malen public function drehen() { for ( i in 0...scheibe.length ) { scheibe[i]._rotation -= geschwindigkeit[i]; } } // drehen } // class Scheiben