Skip to content

Commit

Permalink
添加主题包作者信息
Browse files Browse the repository at this point in the history
  • Loading branch information
upbingun committed Jan 19, 2025
1 parent 3b5052e commit 26a5018
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 458 deletions.
Binary file modified eclipse/OSK-Tools/bin/base/SMaker.class
Binary file not shown.
Binary file modified eclipse/OSK-Tools/bin/fx/Home$NetworkInterfaceInfo.class
Binary file not shown.
Binary file modified eclipse/OSK-Tools/bin/fx/Home.class
Binary file not shown.
Binary file modified eclipse/OSK-Tools/bin/fx/Run.class
Binary file not shown.
Binary file modified eclipse/OSK-Tools/bin/fx/Set.class
Binary file not shown.
2 changes: 1 addition & 1 deletion eclipse/OSK-Tools/bin/res/config.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Sunset
upbingun
OSK Tools V1.0(Sunset)的默认主题。拍摄者:upbingun
OSK Tools Rel. 2501 (Sunset)的默认主题。拍摄者:upbingun
#FFFFFF
#FFFFFF
#FFFFFF
Expand Down
12 changes: 11 additions & 1 deletion eclipse/OSK-Tools/src/base/SMaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
import fx.Set;
import javafx.animation.FadeTransition;
import javafx.animation.Interpolator;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.ScaleTransition;
import javafx.animation.Timeline;
import javafx.geometry.Rectangle2D;
import javafx.scene.Group;
import javafx.scene.effect.GaussianBlur;
Expand Down Expand Up @@ -80,8 +83,15 @@ public static Group maker(VBox root) {
home.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
shrinkTransitionHome.playFromStart();
rootOut.play();
Timeline timeline = new Timeline(
new KeyFrame(Duration.seconds(0.1),
new KeyValue(gaussianBlur.radiusProperty(), 0))
);
timeline.play();
shrinkTransitionHome.setOnFinished(eventFinished -> {
// 动画完成后切换场景


// 动画完成后切换场景
Man.setSence(Home.sHome);
root.setStyle("-fx-opacity: 1.0;");
});
Expand Down
233 changes: 5 additions & 228 deletions eclipse/OSK-Tools/src/fx/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
import java.time.LocalTime;
import base.Info;
import base.L;
import base.SMaker;
import javafx.animation.FadeTransition;
import javafx.animation.Interpolator;
import javafx.animation.ScaleTransition;
import javafx.geometry.Insets;
import javafx.geometry.Rectangle2D;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.effect.GaussianBlur;
Expand All @@ -32,8 +34,8 @@
import javafx.scene.text.Font;

public class Home {
public static Pane gaint=new Pane();
public static Scene sHome=new Scene(gaint,800,600);
public static Group giant=new Group();
public static Scene sHome=new Scene(giant,800,600);
public static VBox root=new VBox();
/**
* 根据当前时间返回相应的问候语。
Expand Down Expand Up @@ -71,233 +73,8 @@ public static void initS() {
infos.setTextFill(Color.web(Config._5));
root.getChildren().addAll(welcome,user,infos);

Image imagebg = new Image("/res/bg.jpg");
ImageView bg = new ImageView(imagebg);
bg.setFitWidth(800);
bg.setFitHeight(600);
bg.setPreserveRatio(true);
bg.setX(0);
bg.setY(0);
//设置高斯模糊
GaussianBlur gaussianBlur = new GaussianBlur();
gaussianBlur.setRadius(5); // 模糊半径
bg.setEffect(gaussianBlur);

Rectangle rect = new Rectangle(800, 600);
rect.setFill(new Color(1, 1, 1, 0.05)); // (R, G, B, opacity)

Image imageMenu = new Image("/res/bg.jpg");
ImageView menu = new ImageView(imageMenu);
Rectangle2D viewportRect = new Rectangle2D(0, 500, 800, 100);
menu.setViewport(viewportRect);
menu.setX(0);menu.setY(500);
gaussianBlur.setRadius(20);
menu.setEffect(gaussianBlur);
Rectangle menuRect = new Rectangle(800, 600);
menuRect.setFill(new Color(1, 1, 1, 0.4)); // (R, G, B, opacity)
menuRect.setX(0);menuRect.setY(500);

FadeTransition rootOut = new FadeTransition(Duration.seconds(0.1), root);
rootOut.setFromValue(1.0); // 起始不透明度
rootOut.setToValue(0.0); // 结束不透明度
rootOut.setCycleCount(1); // 循环次数
rootOut.setAutoReverse(true); // 是否自动反转

// 底部图标显示

// home
ImageView home = new ImageView(new Image("/res/home.jpg"));
home.setX(10);
home.setY(505);

home.setPreserveRatio(true);
home.setPickOnBounds(true); // 确保图片透明部分也能响应点击
// 定义缩小动画(针对 home 节点)
ScaleTransition shrinkTransitionHome = new ScaleTransition(Duration.millis(100), home);
shrinkTransitionHome.setToX(0.85);
shrinkTransitionHome.setToY(0.85);
shrinkTransitionHome.setInterpolator(Interpolator.EASE_IN);

// 定义弹起动画(针对 home 节点)
ScaleTransition growTransitionHome = new ScaleTransition(Duration.millis(100), home);
growTransitionHome.setToX(1.0);
growTransitionHome.setToY(1.0);
growTransitionHome.setInterpolator(Interpolator.EASE_OUT);

// 添加鼠标按下事件监听器
home.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
shrinkTransitionHome.playFromStart();

shrinkTransitionHome.setOnFinished(eventFinished -> {

// 动画完成后切换场景
Man.setSence(Home.sHome);

});
});

// 添加鼠标释放事件监听器
home.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> {
growTransitionHome.playFromStart();
// 可选:处理点击事件
});

// 可选:处理鼠标退出事件,防止在鼠标未释放时动画未恢复
home.addEventHandler(MouseEvent.MOUSE_EXITED, event -> {
growTransitionHome.playFromStart();
});

// 可选:添加点击事件处理器
home.setOnMouseClicked(event -> {
// 这里可以添加点击后的具体操作

});

// run
ImageView run = new ImageView(new Image("/res/run.jpg"));
run.setX(10 + 50 + 10);
run.setY(505);

run.setPreserveRatio(true);
run.setPickOnBounds(true); // 确保图片透明部分也能响应点击

// 定义缩小动画(针对 run 节点)
ScaleTransition shrinkTransitionRun = new ScaleTransition(Duration.millis(100), run);
shrinkTransitionRun.setToX(0.85);
shrinkTransitionRun.setToY(0.85);
shrinkTransitionRun.setInterpolator(Interpolator.EASE_IN);

// 定义弹起动画(针对 run 节点)
ScaleTransition growTransitionRun = new ScaleTransition(Duration.millis(100), run);
growTransitionRun.setToX(1.0);
growTransitionRun.setToY(1.0);
growTransitionRun.setInterpolator(Interpolator.EASE_OUT);

// 添加鼠标按下事件监听器
run.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
shrinkTransitionRun.playFromStart();
rootOut.play();
shrinkTransitionRun.setOnFinished(eventFinished -> {
// 动画完成后切换场景
root.setStyle("-fx-opacity: 1.0;");
Man.setSence(Run.sRun);
});
});

// 添加鼠标释放事件监听器
run.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> {
growTransitionRun.playFromStart();
// 可选:处理点击事件
});

// 可选:处理鼠标退出事件,防止在鼠标未释放时动画未恢复
run.addEventHandler(MouseEvent.MOUSE_EXITED, event -> {
growTransitionRun.playFromStart();
});

// 可选:添加点击事件处理器
run.setOnMouseClicked(event -> {
// 这里可以添加点击后的具体操作

});

// pw
ImageView pw = new ImageView(new Image("/res/pw.jpg"));
pw.setX(10 + 50 + 10 + 50 + 10 + 50 + 10);
pw.setY(505);

pw.setPreserveRatio(true);
pw.setPickOnBounds(true); // 确保图片透明部分也能响应点击

// 定义缩小动画(针对 Pw 节点)
ScaleTransition shrinkTransitionPw = new ScaleTransition(Duration.millis(100), pw);
shrinkTransitionPw.setToX(0.85);
shrinkTransitionPw.setToY(0.85);
shrinkTransitionPw.setInterpolator(Interpolator.EASE_BOTH);

// 定义弹起动画(针对 Pw 节点)
ScaleTransition growTransitionPw = new ScaleTransition(Duration.millis(100), pw);
growTransitionPw.setToX(1.0);
growTransitionPw.setToY(1.0);
growTransitionPw.setInterpolator(Interpolator.EASE_BOTH);

// 添加鼠标按下事件监听器
pw.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
shrinkTransitionPw.playFromStart();
rootOut.play();
shrinkTransitionPw.setOnFinished(eventFinished -> {
// 动画完成后切换场景
Man.setSence(Pw.sPw);
root.setStyle("-fx-opacity: 1.0;");
});
});

// 添加鼠标释放事件监听器
pw.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> {
growTransitionPw.playFromStart();
// 可选:处理点击事件
});

// 可选:处理鼠标退出事件,防止在鼠标未释放时动画未恢复
pw.addEventHandler(MouseEvent.MOUSE_EXITED, event -> {
growTransitionPw.playFromStart();
});

// 可选:添加点击事件处理器
pw.setOnMouseClicked(event -> {
// 这里可以添加点击后的具体操作

});

// set
ImageView set = new ImageView(new Image("/res/set.jpg"));
set.setX(10 + 50 + 10 + 50 + 10);
set.setY(505);

set.setPreserveRatio(true);
set.setPickOnBounds(true); // 确保图片透明部分也能响应点击

// 定义缩小动画(针对 Set 节点)
ScaleTransition shrinkTransitionSet = new ScaleTransition(Duration.millis(100), set);
shrinkTransitionSet.setToX(0.85);
shrinkTransitionSet.setToY(0.85);
shrinkTransitionSet.setInterpolator(Interpolator.EASE_BOTH);

// 定义弹起动画(针对 Set 节点)
ScaleTransition growTransitionSet = new ScaleTransition(Duration.millis(100), set);
growTransitionSet.setToX(1.0);
growTransitionSet.setToY(1.0);
growTransitionSet.setInterpolator(Interpolator.EASE_BOTH);

// 添加鼠标按下事件监听器
set.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
shrinkTransitionSet.playFromStart();
rootOut.play();
shrinkTransitionSet.setOnFinished(eventFinished -> {
// 动画完成后切换场景
Man.setSence(Set.sSet);
root.setStyle("-fx-opacity: 1.0;");
});
});

// 添加鼠标释放事件监听器
set.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> {
growTransitionSet.playFromStart();
// 可选:处理点击事件
});

// 可选:处理鼠标退出事件,防止在鼠标未释放时动画未恢复
set.addEventHandler(MouseEvent.MOUSE_EXITED, event -> {
growTransitionSet.playFromStart();
});

// 可选:添加点击事件处理器
set.setOnMouseClicked(event -> {
// 这里可以添加点击后的具体操作

});

gaint.getChildren().addAll(bg,rect,menu,menuRect,home,run,pw,set,root);
giant.getChildren().add(SMaker.maker(root));
}
/**
* 获取关于电脑的信息
Expand Down
Loading

0 comments on commit 26a5018

Please sign in to comment.