home *** CD-ROM | disk | FTP | other *** search
- import java.awt.image.MemoryImageSource;
-
- public class RotateTransition extends BannerTransition {
- static final double SIN_45_DEGREES = 0.707106781;
- int rotateAmount;
- int location;
- double currentAngle;
- double angleIncrease;
- double perpen;
-
- public RotateTransition() {
- super.numOfFrames = 8;
- }
-
- public void finishInit() {
- super.delay = 200;
- this.angleIncrease = (Math.PI / 2D) * ((double)1.0F / (double)(super.numOfFrames + 1));
- this.currentAngle = this.angleIncrease;
- this.perpen = (double)super.imageHeight / (double)2.0F * 0.707106781;
-
- for(int f = 0; f < super.numOfFrames; ++f) {
- try {
- Thread.sleep(100L);
- } catch (InterruptedException var6) {
- }
-
- this.Rotate();
-
- try {
- Thread.sleep(100L);
- } catch (InterruptedException var5) {
- }
-
- super.frames[f] = super.owner.createImage(new MemoryImageSource(super.imageWidth, super.imageHeight, super.workPixels, 0, super.imageWidth));
- super.owner.prepareImage(super.frames[f], super.owner);
- this.currentAngle += this.angleIncrease;
- }
-
- super.workPixels = null;
- }
-
- final void Rotate() {
- double top_Banner_h = (double)super.imageHeight / (double)2.0F * Math.sin((Math.PI / 2D) - this.currentAngle) + (double)super.imageHeight / (double)2.0F;
- double bottom_Banner_h = (double)super.imageHeight / (double)2.0F * Math.sin(this.currentAngle) + (double)super.imageHeight / (double)2.0F;
- int location = super.imageHeight - (int)(bottom_Banner_h * Math.sin(this.currentAngle));
- float adder = (float)top_Banner_h / (float)location;
- float position = (float)super.imageHeight - (float)top_Banner_h + adder - 1.0F;
-
- for(int y = 0; y < location; ++y) {
- System.arraycopy(super.owner.banners[super.owner.currentBanner].imagePixels, (int)position * super.imageWidth, super.workPixels, y * super.imageWidth, super.imageWidth);
- position += adder;
- }
-
- adder = (float)bottom_Banner_h / (float)(super.imageHeight - location);
- position = 0.0F;
-
- for(int y = location; y < super.imageHeight; ++y) {
- System.arraycopy(super.owner.banners[super.owner.nextBanner].imagePixels, (int)position * super.imageWidth, super.workPixels, y * super.imageWidth, super.imageWidth);
- position += adder;
- }
-
- }
- }
-