Drehender Text mit JavaFX Script

(c) Ralph Steyer - rjs.de - www.javafx-buch.de

Der Quelltext


/*
 * Main.fx
 *
 * Created on 26.12.2008, 21:49:01
 */

package javafxapplication4;

import javafx.animation.Interpolator;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.scene.effect.*;
import javafx.scene.paint.*;
import javafx.scene.Scene;
import javafx.scene.shape.Circle;
import javafx.scene.text.*;
import javafx.scene.transform.*;
import javafx.stage.Stage;

var scale = 1.0;
var color = Color.AQUA;
Timeline {
  repeatCount: Timeline.INDEFINITE
  keyFrames: [
      KeyFrame {
          time: 3s
          canSkip: true
          values: [
              scale => -1.0 tween Interpolator.EASEBOTH
              color => Color.GREEN
          ]
      }
  ]
}.play();
Stage {
  title: "Animierter Text als JavaFX-Applikation"
  width: 400
  height: 240
  scene: Scene {
      width: 400
      height: 200
      content: [
          Circle {
              centerX: 200,
              centerY: 100
              radius: 90
              fill: RadialGradient {
                  centerX: 75
                  centerY: 75
                  radius: 90
                  proportional: false
                  stops: [
                      Stop {
                          offset: 0.0
                      color: Color.RED},
                      Stop {
                          offset: 1.0
                      color: Color.DARKRED}
                  ] // stops

              } // RadialGradient
          }
          Text {
              font: Font {
                  size: 20
              }
              x: 110,
              y: 90
              textAlignment: TextAlignment.CENTER
              content:"Willkommen bei\nRJS EDV-KnowHow\nwww.rjs.de"
              fill: bind color
              effect: DropShadow {
                  offsetX: 10
                  offsetY:10
                  color: Color.color(0.1, 0.3, 0.1)
              };  // DropShadow
              transforms: Scale{
                  x: 1
                  y: bind scale
                  pivotX: 100,
                  pivotY: 100
              } // Scale
          }  //Text
      ]
  }
}

Dipl. Math. Ralph Steyer - Fon 0171/5489948 - Fax 06198/577653 - E-Mail: ralph.steyer@rjs.de - www.rjs.de