javafx方块系统

javafx方块系统

ID:39550633

大小:36.00 KB

页数:4页

时间:2019-07-06

javafx方块系统_第1页
javafx方块系统_第2页
javafx方块系统_第3页
javafx方块系统_第4页
资源描述:

《javafx方块系统》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、/***Copyright(c)2008,2012Oracleand/oritsaffiliates.*Allrightsreserved.Useissubjecttolicenseterms.*/importjavafx.scene.transform.Rotate;importjavafx.scene.PerspectiveCamera;importjavafx.scene.transform.Translate;importjavafx.application.Application;importjavafx.scene.Group;importjavafx.scene.Scene;

2、importjavafx.stage.Stage;importjavafx.animation.Animation;importjavafx.animation.KeyFrame;importjavafx.animation.KeyValue;importjavafx.animation.Timeline;importjavafx.scene.Node;importjavafx.scene.paint.Color;importjavafx.scene.shape.RectangleBuilder;importjavafx.util.Duration;/***Asamplethatdemon

3、stratesananimatedrotationof3Dcubes.Whenthe*applicationrunsinstandAlonemode,thescenemustbeconstructedwith*thedepthBufferargumentsettotrue,andtherootnodemusthavedepthTest*settotrue.**@seejavafx.scene.transform.Rotate*@seejavafx.scene.paint.Color*@seejavafx.scene.shape.RectangleBuilder*/publicclassCu

4、beSampleextendsApplication{privateTimelineanimation;privatevoidinit(StageprimaryStage){Grouproot=newGroup();primaryStage.setResizable(false);primaryStage.setScene(newScene(root,400,150,true));primaryStage.getScene().setCamera(newPerspectiveCamera());root.getTransforms().addAll(newTranslate(400/2,1

5、50/2),newRotate(180,Rotate.X_AXIS));root.getChildren().add(create3dContent());}publicNodecreate3dContent(){Cubec1=newCube(50,Color.RED,1);c1.rx.setAngle(45);c1.ry.setAngle(45);Cubec2=newCube(50,Color.GREEN,1);c2.setTranslateX(100);c2.rx.setAngle(45);c2.ry.setAngle(45);Cubec3=newCube(50,Color.ORANG

6、E,1);c3.setTranslateX(-100);c3.rx.setAngle(45);c3.ry.setAngle(45);animation=newTimeline();animation.getKeyFrames().addAll(newKeyFrame(Duration.ZERO,newKeyValue(c1.ry.angleProperty(),0d),newKeyValue(c2.rx.angleProperty(),0d),newKeyValue(c3.rz.angleProperty(),0d)),newKeyFrame(Duration.seconds(1),new

7、KeyValue(c1.ry.angleProperty(),360d),newKeyValue(c2.rx.angleProperty(),360d),newKeyValue(c3.rz.angleProperty(),360d)));animation.setCycleCount(Animation.INDEFINITE);returnnewGroup(c1,c2,c3);}publicvoidplay(){anim

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。