# -*- coding:utf-8 -*- # title :地球季节(四季和24节气)函数功能 # description : # author :Python超人 # date :2023-02-11 # link :https://gitcode.net/pythoncr/ # python_version :3.8 # ============================================================================== from ursina import camera from bodies import Sun, Earth from common.consts import SECONDS_PER_DAY, AU def create_trans_earth(name, text_color, position): """ 创建透明的地球 @param name: 名称 @param text_color: 文字颜色 @param position: 地球的位置 @return: """ return Earth(name=name, size_scale=5e3, texture="earth_transparent.png", # 明的地球纹理 text_color=text_color, rotation_speed=0, init_position=position, init_velocity=[0, 0, 0]).set_ignore_gravity(True) # 忽略重力 def create_important_pos_earths(): earth_1 = create_trans_earth(name="春分", text_color=(0, 255, 0), position=[-1.05 * AU, 0, 0]) earth_2 = create_trans_earth(name="夏至", text_color=(255, 0, 0), position=[0, 0, -1.05 * AU]) earth_3 = create_trans_earth(name="秋分", text_color=(255, 255, 0), position=[1.05 * AU, 0, 0]) earth_4 = create_trans_earth(name="冬至", text_color=(0, 255, 255), position=[0, 0, 1.05 * AU]) return earth_1, earth_2, earth_3, earth_4 def get_solar_terms_angles(): """ 中国农历24节气表,数据为 节气名称 和 camera.rotation_y 的角度范围值 @return: """ solar_terms_angles = [ ("小寒", -22.5, -7.5), ("大寒", -37.5, -22.5), ("立春", -52.5, -37.5), ("雨水", -67.5, -52.5), ("惊蛰", -82.5, -67.5), ("春分", -97.5, -82.5), ("清明", -112.5, -97.5), ("谷雨", -127.5, -112.5), ("立夏", -142.5, -127.5), ("小满", -157.5, -142.5), ("芒种", -172.5, -157.5), ("夏至", -180, -172.5), ("夏至", 172.5, 180), ("小暑", 157.5, 172.5), ("大暑", 142.5, 157.5), ("立秋", 127.5, 142.5), ("处暑", 112.5, 127.5), ("白露", 97.5, 112.5), ("秋分", 82.5, 97.5), ("寒露", 67.5, 82.5), ("霜降", 52.5, 67.5), ("立冬", 37.5, 52.5), ("小雪", 22.5, 37.5), ("大雪", 7.5, 22.5), ("冬至", -7.5, 7.5)] return solar_terms_angles