著作一覧 |
import javafx.stage.Stage; import javafx.scene.Scene; import javafx.animation.Timeline; import javafx.animation.KeyFrame; import javafx.scene.shape.Line; import javafx.scene.paint.Color; import javafx.animation.Interpolator; import javafx.scene.shape.Circle; import javafx.scene.paint.RadialGradient; import javafx.scene.paint.Stop; /** * @author arton */ var x = 0.0; var y = 0.0; Timeline { repeatCount: Timeline.INDEFINITE keyFrames : [ KeyFrame { time : 10s canSkip : true values : [ x => 300.0 tween Interpolator.LINEAR, y => function() { var rx = x - 150.0; return rx * rx * 0.2 - 0.5 * rx + 70; }() ] } ] }.play(); Stage { title: "Timeline" width: 300 height: 300 scene: Scene { fill: RadialGradient { centerX: 50, centerY: 10 radius: 300 proportional: false stops: [ Stop { offset: 0.0 color: Color.web("#3B8DED") }, Stop { offset: 1.0 color: Color.web("#044EA4") } ] } content: [ Line { startX: 0, startY: 140 endX: 290, endY: 140 strokeWidth: 1 stroke: Color.BLACK } Line { startX: 140, startY: 0 endX: 140, endY: 300 strokeWidth: 1 stroke: Color.BLACK } Circle { centerX: bind x, centerY: bind y radius: 4 fill: Color.YELLOW } ] } }
ジェズイットを見習え |