From 7387b622374a8f40da711e3eff47dd36740025d8 Mon Sep 17 00:00:00 2001 From: march3 Date: Sat, 28 Oct 2023 09:45:09 +0800 Subject: [PATCH] =?UTF-8?q?Python=E8=B6=85=E4=BA=BA-=E5=AE=87=E5=AE=99?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/color_utils.py | 15 ----------- sim_scenes/tri_bodies/two_way_foil.py | 36 ++------------------------- 2 files changed, 2 insertions(+), 49 deletions(-) diff --git a/common/color_utils.py b/common/color_utils.py index d8a1726..62e2c8b 100644 --- a/common/color_utils.py +++ b/common/color_utils.py @@ -34,21 +34,6 @@ def conv_to_vec4_color(colour: tuple, alpha=1): # color = ursina_color.rgba(r, g, b, a) -# def brightest(color): -# if isinstance(color, tuple): -# r, g, b = color -# elif isinstance(color, list): -# r, g, b = color -# -# brightest_color 等于的值就是 r g b 同时按照比例增加,直到 r g b 其中一个值达到 255 为止, -# 比如: r=127 g=20 b=40,则 brightest_color=127*2 约等于 255, g=20*2=40 b=40*2=80 -# brightest_color的 r g b 就等于 255 40 80 -# 请实现以下代码: -# TODO: -# -# -# return brightest_color - def brightest(color): if isinstance(color, tuple): r, g, b = color diff --git a/sim_scenes/tri_bodies/two_way_foil.py b/sim_scenes/tri_bodies/two_way_foil.py index 5b45f9d..f8de04f 100644 --- a/sim_scenes/tri_bodies/two_way_foil.py +++ b/sim_scenes/tri_bodies/two_way_foil.py @@ -104,38 +104,6 @@ class TwoWayFoilSim: ext_fun_for_method(self.two_way_foil.planet, after_run_fun=change_two_way_foil) - # def flatten_animation(self, body): - # """ - # 天体二维化的动画 - # @param body: 天体 - # @return: - # """ - # - # def flatten_update(planet): - # def warp(): - # # 原始的 update 方法中有计算天体的运行 - # planet.original_update() - # - # # 对Y轴进行压平动画,如果压平大小不足 1/50,则继续压缩,直到压缩到 1/50 就不压缩了 - # # (如果觉得 1/50 的厚度压的不够,还可以继续压缩,基本上就够了) - # if planet.scale_y_v > planet.init_scale_y / 50: - # planet.scale_y_v /= 1.01 - # # 灯光关闭,不然压到2纬就会是黑色 - # planet.set_light_off(True) - # planet.scale_y = planet.scale_y_v - # - # return warp - # - # body.is_2d = True - # # 压平时,转速将为以前的 1/20 - # body.planet.rotation_speed /= 20 - # # 记录原始的厚度大小 - # body.planet.scale_y_v = body.planet.scale_y - # body.planet.init_scale_y = body.planet.scale_y - # # 原始的 update 方法中有计算天体的运行,需要保留 - # body.planet.original_update = body.planet.update - # # 替换 update - # body.planet.update = flatten_update(body.planet) def gen_pixcel_image(self, planet): """ 将纹理图改为像素图片 @@ -189,8 +157,8 @@ class TwoWayFoilSim: return warp body.is_2d = True - # 压平时,转速将为以前的 1/20 - body.planet.rotation_speed /= 20 + # 压平时,转速将为以前的 1/200 + body.planet.rotation_speed /= 200 # 记录原始的厚度大小 body.planet.scale_y_v = body.planet.scale_y body.planet.init_scale_y = body.planet.scale_y -- GitLab