spore-engine 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- demo.py +500 -0
- demos/__init__.py +272 -0
- demos/scene_3d.py +223 -0
- demos/scene_abyssal_bloom.py +515 -0
- demos/scene_anim.py +90 -0
- demos/scene_anim_path.py +94 -0
- demos/scene_astral_cathedral.py +103 -0
- demos/scene_aurora.py +57 -0
- demos/scene_aurora_lagoon.py +444 -0
- demos/scene_aurora_palace.py +106 -0
- demos/scene_aurora_storm.py +115 -0
- demos/scene_autumn_forest.py +730 -0
- demos/scene_bioluminescence.py +78 -0
- demos/scene_biome_demo.py +25 -0
- demos/scene_black_hole.py +134 -0
- demos/scene_braille_current.py +149 -0
- demos/scene_celestial_temple.py +123 -0
- demos/scene_cellular.py +66 -0
- demos/scene_code_shader.py +121 -0
- demos/scene_constellation.py +131 -0
- demos/scene_cosmic_tunnel.py +126 -0
- demos/scene_crystal_cluster.py +133 -0
- demos/scene_crystal_nebula.py +133 -0
- demos/scene_dna.py +56 -0
- demos/scene_double_pendulum.py +115 -0
- demos/scene_dungeon.py +44 -0
- demos/scene_eclipse.py +97 -0
- demos/scene_ecs_lifecycle.py +281 -0
- demos/scene_ecs_swarm.py +286 -0
- demos/scene_erosion.py +51 -0
- demos/scene_ethereal_ruins.py +225 -0
- demos/scene_field_demo.py +59 -0
- demos/scene_fireflies.py +118 -0
- demos/scene_flocking.py +135 -0
- demos/scene_flowfield.py +97 -0
- demos/scene_forest_fire.py +89 -0
- demos/scene_fractals.py +74 -0
- demos/scene_fx.py +126 -0
- demos/scene_galaxy.py +84 -0
- demos/scene_geometric_flower.py +97 -0
- demos/scene_glyph_art.py +157 -0
- demos/scene_god_rays.py +269 -0
- demos/scene_golden_city.py +108 -0
- demos/scene_gravity.py +128 -0
- demos/scene_horizon.py +395 -0
- demos/scene_hypercube.py +119 -0
- demos/scene_infinite_temple.py +152 -0
- demos/scene_isometric.py +46 -0
- demos/scene_kaleidoscope.py +41 -0
- demos/scene_landscape.py +102 -0
- demos/scene_lava.py +80 -0
- demos/scene_lightning.py +77 -0
- demos/scene_lorenz.py +89 -0
- demos/scene_media_player.py +119 -0
- demos/scene_meteor.py +80 -0
- demos/scene_misc.py +106 -0
- demos/scene_neon_cathedral.py +122 -0
- demos/scene_neon_city.py +150 -0
- demos/scene_neon_grid.py +54 -0
- demos/scene_new_features.py +97 -0
- demos/scene_new_features2.py +377 -0
- demos/scene_particles.py +84 -0
- demos/scene_phantom_galaxy.py +78 -0
- demos/scene_phoenix.py +148 -0
- demos/scene_phosphor.py +171 -0
- demos/scene_photo_ascii.py +46 -0
- demos/scene_physics_enhanced.py +131 -0
- demos/scene_physics_rigid.py +103 -0
- demos/scene_platformer.py +174 -0
- demos/scene_powder.py +74 -0
- demos/scene_prism_raytracer.py +72 -0
- demos/scene_ragdoll.py +300 -0
- demos/scene_raytracer_alien.py +37 -0
- demos/scene_raytracer_crystal.py +40 -0
- demos/scene_raytracer_infinity.py +37 -0
- demos/scene_raytracer_jewel.py +46 -0
- demos/scene_raytracer_moonlit.py +43 -0
- demos/scene_raytracer_nebula.py +42 -0
- demos/scene_raytracer_photo.py +36 -0
- demos/scene_raytracer_reflections.py +48 -0
- demos/scene_raytracer_system.py +36 -0
- demos/scene_raytracer_toybox.py +36 -0
- demos/scene_ripples.py +39 -0
- demos/scene_scenery.py +84 -0
- demos/scene_screenfx.py +84 -0
- demos/scene_sdf_csg.py +41 -0
- demos/scene_sdf_dreamscape.py +75 -0
- demos/scene_sdf_glow.py +45 -0
- demos/scene_shader_symphony.py +126 -0
- demos/scene_shaders.py +96 -0
- demos/scene_shadows.py +81 -0
- demos/scene_sierpinski.py +122 -0
- demos/scene_sim.py +65 -0
- demos/scene_solar_flare.py +57 -0
- demos/scene_spline_demo.py +55 -0
- demos/scene_stained_glass.py +68 -0
- demos/scene_starry_night.py +57 -0
- demos/scene_synthwave.py +126 -0
- demos/scene_terminal_app.py +284 -0
- demos/scene_terrain_flyover.py +71 -0
- demos/scene_tilemap.py +108 -0
- demos/scene_timeline.py +86 -0
- demos/scene_tui.py +199 -0
- demos/scene_tunnel.py +35 -0
- demos/scene_ui.py +82 -0
- demos/scene_underwater.py +105 -0
- demos/scene_video_player.py +76 -0
- demos/scene_voxel_world.py +59 -0
- demos/scene_walkers.py +317 -0
- demos/scene_worley.py +34 -0
- easy_demo.py +81 -0
- shader_sandbox.py +26 -0
- spore_engine/__init__.py +170 -0
- spore_engine/__version__.py +4 -0
- spore_engine/anim/__init__.py +3 -0
- spore_engine/anim/anim.py +401 -0
- spore_engine/anim/ik.py +198 -0
- spore_engine/anim/timeline.py +191 -0
- spore_engine/cli.py +267 -0
- spore_engine/core/__init__.py +150 -0
- spore_engine/core/_accel.py +49 -0
- spore_engine/core/_optional.py +40 -0
- spore_engine/core/assets.py +324 -0
- spore_engine/core/camera.py +94 -0
- spore_engine/core/canvas.py +692 -0
- spore_engine/core/color.py +282 -0
- spore_engine/core/draw.py +542 -0
- spore_engine/core/ecs.py +197 -0
- spore_engine/core/geom.py +247 -0
- spore_engine/core/glyphs.py +62 -0
- spore_engine/core/input.py +702 -0
- spore_engine/core/reload.py +282 -0
- spore_engine/core/scene.py +145 -0
- spore_engine/core/scene_file.py +375 -0
- spore_engine/core/sprite.py +55 -0
- spore_engine/core/state.py +184 -0
- spore_engine/core/term.py +541 -0
- spore_engine/core/util.py +170 -0
- spore_engine/easy/__init__.py +17 -0
- spore_engine/easy/anim.py +164 -0
- spore_engine/easy/app.py +747 -0
- spore_engine/easy/sprite.py +297 -0
- spore_engine/easy/systems.py +908 -0
- spore_engine/easy/util.py +15 -0
- spore_engine/easy/widgets.py +101 -0
- spore_engine/fx/__init__.py +15 -0
- spore_engine/fx/effects.py +376 -0
- spore_engine/fx/field.py +117 -0
- spore_engine/fx/lightfield.py +621 -0
- spore_engine/fx/lighting.py +163 -0
- spore_engine/fx/postfx.py +268 -0
- spore_engine/fx/screenfx.py +157 -0
- spore_engine/fx/shader_lab.py +430 -0
- spore_engine/fx/shaderlab.py +345 -0
- spore_engine/fx/shaders.py +528 -0
- spore_engine/fx/textfx.py +143 -0
- spore_engine/fx/transitions.py +159 -0
- spore_engine/fx/volumetric.py +195 -0
- spore_engine/gen/__init__.py +13 -0
- spore_engine/gen/biome_terrain.py +105 -0
- spore_engine/gen/delaunay.py +173 -0
- spore_engine/gen/dungeon.py +515 -0
- spore_engine/gen/erosion.py +202 -0
- spore_engine/gen/fractals.py +171 -0
- spore_engine/gen/lsystem.py +87 -0
- spore_engine/gen/marching_cubes.py +394 -0
- spore_engine/gen/maze.py +144 -0
- spore_engine/gen/pathfinding.py +140 -0
- spore_engine/gen/scenery.py +292 -0
- spore_engine/gen/splines.py +98 -0
- spore_engine/gen/terrain.py +152 -0
- spore_engine/gen/wfc.py +202 -0
- spore_engine/media/__init__.py +5 -0
- spore_engine/media/_pillow_compat.py +24 -0
- spore_engine/media/ansi_io.py +175 -0
- spore_engine/media/converter.py +264 -0
- spore_engine/media/export.py +378 -0
- spore_engine/media/ffmpeg.py +225 -0
- spore_engine/media/glyphart.py +326 -0
- spore_engine/media/imaging.py +110 -0
- spore_engine/media/img3d.py +201 -0
- spore_engine/media/video.py +287 -0
- spore_engine/render3d/__init__.py +7 -0
- spore_engine/render3d/engine3d.py +250 -0
- spore_engine/render3d/isometric.py +91 -0
- spore_engine/render3d/model_loader.py +127 -0
- spore_engine/render3d/raytracer.py +386 -0
- spore_engine/render3d/sdf.py +231 -0
- spore_engine/render3d/voxel.py +100 -0
- spore_engine/sim/__init__.py +9 -0
- spore_engine/sim/cellular.py +277 -0
- spore_engine/sim/fluid.py +261 -0
- spore_engine/sim/noise.py +248 -0
- spore_engine/sim/physics.py +988 -0
- spore_engine/sim/physics3d.py +194 -0
- spore_engine/sim/powder.py +447 -0
- spore_engine/sim/softbody.py +238 -0
- spore_engine/sim/steering.py +228 -0
- spore_engine/ui/__init__.py +4 -0
- spore_engine/ui/font.py +113 -0
- spore_engine/ui/tilemap.py +194 -0
- spore_engine/ui/toolkit.py +476 -0
- spore_engine/ui/widgets.py +819 -0
- spore_engine-0.1.0.dist-info/METADATA +342 -0
- spore_engine-0.1.0.dist-info/RECORD +209 -0
- spore_engine-0.1.0.dist-info/WHEEL +5 -0
- spore_engine-0.1.0.dist-info/entry_points.txt +3 -0
- spore_engine-0.1.0.dist-info/licenses/LICENSE +121 -0
- spore_engine-0.1.0.dist-info/top_level.txt +5 -0
demos/scene_anim_path.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import math, random
|
|
2
|
+
from spore_engine.core.color import Color, WHITE, RED, GREEN, BLUE, YELLOW, CYAN, ORANGE, DIM, PALETTES
|
|
3
|
+
from spore_engine.core.canvas import Canvas
|
|
4
|
+
from spore_engine.anim.anim import Entity, Animator, Path, PathFollower, Tween, Oscillator, lerp_color
|
|
5
|
+
|
|
6
|
+
_LS = None
|
|
7
|
+
|
|
8
|
+
def scene_anim_path(c, hr, t, pt, dt):
|
|
9
|
+
global _LS
|
|
10
|
+
if _LS is None:
|
|
11
|
+
entity = Entity(c.w // 2, c.h // 2)
|
|
12
|
+
path = Path()
|
|
13
|
+
pts = 8
|
|
14
|
+
for i in range(pts):
|
|
15
|
+
angle = 2 * math.pi * i / pts
|
|
16
|
+
r = 10 + 5 * (1 if i % 2 == 0 else 0)
|
|
17
|
+
path.add_point(c.w // 2 + r * math.cos(angle),
|
|
18
|
+
c.h // 2 + 5 * math.sin(angle))
|
|
19
|
+
follower = PathFollower(path, duration=5.0, loop=True, easing='sine_in_out')
|
|
20
|
+
follower2 = PathFollower(path, duration=7.0, loop=True, easing='linear')
|
|
21
|
+
|
|
22
|
+
bounce = Tween(duration=1.2, easing='bounce_out', loop=True, yoyo=True)
|
|
23
|
+
elastic = Tween(duration=2.0, easing='elastic_out', loop=True, yoyo=True)
|
|
24
|
+
osc = Oscillator(period=0.8, min_val=0.0, max_val=1.0)
|
|
25
|
+
|
|
26
|
+
_LS = {
|
|
27
|
+
'entity': entity,
|
|
28
|
+
'path': path,
|
|
29
|
+
'follower': follower,
|
|
30
|
+
'follower2': follower2,
|
|
31
|
+
'bounce': bounce,
|
|
32
|
+
'elastic': elastic,
|
|
33
|
+
'osc': osc,
|
|
34
|
+
'time': 0.0,
|
|
35
|
+
'balls': [],
|
|
36
|
+
}
|
|
37
|
+
for i in range(6):
|
|
38
|
+
_LS['balls'].append({
|
|
39
|
+
'x': 10 + i * 12,
|
|
40
|
+
'base_y': c.h // 2 + 6,
|
|
41
|
+
'tween': Tween(duration=0.8 + i * 0.2,
|
|
42
|
+
easing=['bounce_out', 'elastic_out', 'back_out',
|
|
43
|
+
'cubic_in_out', 'sine_in_out', 'quad_in_out'][i],
|
|
44
|
+
loop=True, yoyo=True),
|
|
45
|
+
'color': [RED, GREEN, BLUE, YELLOW, CYAN, ORANGE][i],
|
|
46
|
+
'label': ['bounce', 'elastic', 'back', 'cubic', 'sine', 'quad'][i],
|
|
47
|
+
})
|
|
48
|
+
s = _LS
|
|
49
|
+
|
|
50
|
+
s['time'] += dt
|
|
51
|
+
s['follower'].update(dt)
|
|
52
|
+
s['follower2'].update(dt)
|
|
53
|
+
s['bounce'].update(dt)
|
|
54
|
+
s['elastic'].update(dt)
|
|
55
|
+
|
|
56
|
+
c.clear()
|
|
57
|
+
for y in range(c.h):
|
|
58
|
+
ty = y / c.h
|
|
59
|
+
for x in range(c.w):
|
|
60
|
+
n = (math.sin(x*0.02+t*0.2)+math.cos(y*0.03+t*0.15))*0.5+0.5
|
|
61
|
+
c.set_pixel(x, y, ' ', bg=Color(int(3+n*6), int(1+n*4), int(8+n*18)), z=-100)
|
|
62
|
+
|
|
63
|
+
s['path'].render(c, '.', Color(40, 40, 60), z=5)
|
|
64
|
+
|
|
65
|
+
px, py = s['follower'].get_position()
|
|
66
|
+
c.set_pixel(round(px), round(py), '@', WHITE, z=15)
|
|
67
|
+
c.draw_text(round(px) + 1, round(py), 'sine', DIM, z=15)
|
|
68
|
+
|
|
69
|
+
px2, py2 = s['follower2'].get_position()
|
|
70
|
+
c.set_pixel(round(px2), round(py2), '♦', Color(200, 100, 255), z=15)
|
|
71
|
+
c.draw_text(round(px2) + 1, round(py2), 'linear', DIM, z=15)
|
|
72
|
+
|
|
73
|
+
for ball in s['balls']:
|
|
74
|
+
ball['tween'].update(dt)
|
|
75
|
+
v = ball['tween'].value
|
|
76
|
+
by = ball['base_y'] - v * 8
|
|
77
|
+
c.set_pixel(round(ball['x']), round(by), '●', ball['color'], z=10)
|
|
78
|
+
bar_w = int(v * 10)
|
|
79
|
+
for bx in range(bar_w):
|
|
80
|
+
c.set_pixel(round(ball['x']) - 5 + bx, round(by) + 2, '▄', ball['color'].mul(0.5), z=5)
|
|
81
|
+
c.draw_text(round(ball['x']) - 3, round(by) - 2, ball['label'], DIM, z=10)
|
|
82
|
+
|
|
83
|
+
elastic_v = s['elastic'].value
|
|
84
|
+
bounce_v = s['bounce'].value
|
|
85
|
+
c.draw_rect(c.w // 2 - 25, c.h - 5, 20, 2, ' ', bg=RED.mul(0.3), z=5, fill=True)
|
|
86
|
+
for i in range(20):
|
|
87
|
+
tgt = int(20 * bounce_v)
|
|
88
|
+
if i < tgt:
|
|
89
|
+
c.set_pixel(c.w // 2 - 25 + i, c.h - 5, '█', RED, z=10)
|
|
90
|
+
|
|
91
|
+
c.draw_text(2, 0, "Animation System | Path following + tweens", WHITE, z=20)
|
|
92
|
+
c.draw_text(2, 1, f"Path points: {len(s['path'].points)} | Loop: 5s/7s", DIM, z=20)
|
|
93
|
+
easing_names = ['bounce', 'elastic', 'back', 'cubic', 'sine', 'quad']
|
|
94
|
+
c.draw_text(2, c.h - 1, "Balls show different easing functions", DIM, z=20)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import math
|
|
2
|
+
from spore_engine import *
|
|
3
|
+
from spore_engine.core.color import *
|
|
4
|
+
|
|
5
|
+
def scene_astral_cathedral(c, hr, t, pt, dt):
|
|
6
|
+
w, h = c.w, c.h
|
|
7
|
+
|
|
8
|
+
for y in range(h):
|
|
9
|
+
ty = y / h
|
|
10
|
+
col = Color(int(3+ty*12), int(2+ty*6), int(5+ty*25))
|
|
11
|
+
for x in range(w):
|
|
12
|
+
c.set_pixel(x, y, ' ', bg=col, z=-100)
|
|
13
|
+
|
|
14
|
+
arch_centers = [w//4, w//2, 3*w//4]
|
|
15
|
+
arch_widths = [w//6, w//5, w//6]
|
|
16
|
+
arch_heights = [h//3, h//2 + h//6, h//3]
|
|
17
|
+
|
|
18
|
+
for idx in range(3):
|
|
19
|
+
cx_a = arch_centers[idx]
|
|
20
|
+
aw = arch_widths[idx]
|
|
21
|
+
ah = arch_heights[idx]
|
|
22
|
+
col_pillar = Color(25+idx*5, 18+idx*3, 35+idx*10)
|
|
23
|
+
col_pillar_dark = Color(12+idx*3, 8+idx*2, 18+idx*5)
|
|
24
|
+
|
|
25
|
+
pillar_l = cx_a - aw
|
|
26
|
+
pillar_r = cx_a + aw
|
|
27
|
+
floor_y = h - 1
|
|
28
|
+
arch_top = h - ah
|
|
29
|
+
|
|
30
|
+
for y in range(arch_top, floor_y+1):
|
|
31
|
+
ty_p = (y - arch_top) / max(1, floor_y - arch_top)
|
|
32
|
+
for x in range(w):
|
|
33
|
+
dx_l = abs(x - pillar_l)
|
|
34
|
+
dx_r = abs(x - pillar_r)
|
|
35
|
+
is_arch = False
|
|
36
|
+
if x >= pillar_l - 2 and x < pillar_l:
|
|
37
|
+
c.set_pixel(x, y, '║', col_pillar, z=5)
|
|
38
|
+
is_arch = True
|
|
39
|
+
elif x > pillar_r and x <= pillar_r + 2:
|
|
40
|
+
c.set_pixel(x, y, '║', col_pillar, z=5)
|
|
41
|
+
is_arch = True
|
|
42
|
+
elif y < floor_y - 5 and (x < pillar_l - 2 or x > pillar_r + 2):
|
|
43
|
+
continue
|
|
44
|
+
|
|
45
|
+
if y == floor_y:
|
|
46
|
+
for x in range(w):
|
|
47
|
+
c.set_pixel(x, y, '═', col_pillar_dark, z=5)
|
|
48
|
+
|
|
49
|
+
for y in range(arch_top - int(h*0.1), floor_y+1):
|
|
50
|
+
for x in range(pillar_l, pillar_r+1):
|
|
51
|
+
d = 0
|
|
52
|
+
if y < arch_top:
|
|
53
|
+
dy_a = arch_top - y
|
|
54
|
+
curve = (1 - (dy_a / (h*0.15))**2) * aw
|
|
55
|
+
if abs(x - cx_a) > curve:
|
|
56
|
+
continue
|
|
57
|
+
if y < floor_y - 1:
|
|
58
|
+
c.set_pixel(x, y, ' ', bg=Color.from_hsv(0.7+(y/h)*0.1, 0.4, 0.02+(y/h)*0.06), z=3)
|
|
59
|
+
|
|
60
|
+
center_arch = arch_centers[1]
|
|
61
|
+
cw = arch_widths[1]
|
|
62
|
+
ch_ = arch_heights[1]
|
|
63
|
+
apse_top = h - ch_
|
|
64
|
+
apse_cy = center_arch
|
|
65
|
+
apse_r = cw
|
|
66
|
+
|
|
67
|
+
for y in range(h):
|
|
68
|
+
for x in range(w):
|
|
69
|
+
d = math.hypot(x - apse_cy, y - (apse_top + apse_r*0.3))
|
|
70
|
+
if d < apse_r * 0.8:
|
|
71
|
+
a = math.atan2(y - (apse_top + apse_r*0.3), x - apse_cy)
|
|
72
|
+
hue = (a/(2*math.pi) + t*0.01) % 1.0
|
|
73
|
+
sat = 0.5 + 0.4 * (1 - d/(apse_r*0.8))
|
|
74
|
+
bright = 0.1 + 0.6 * (1 - d/(apse_r*0.8))
|
|
75
|
+
ch = ' ' if bright < 0.15 else ('░' if bright < 0.3 else ('▒' if bright < 0.5 else ('▓' if bright < 0.65 else '█')))
|
|
76
|
+
c.set_pixel(x, y, ch, Color.from_hsv(hue, sat, bright), z=4)
|
|
77
|
+
|
|
78
|
+
for x in range(apse_cy - int(apse_r*0.7), apse_cy + int(apse_r*0.7)+1):
|
|
79
|
+
for y in range(apse_top-int(h*0.05), apse_top+1):
|
|
80
|
+
if 0 <= x < w and 0 <= y < h:
|
|
81
|
+
dist = abs(x - apse_cy) / (apse_r*0.7)
|
|
82
|
+
col = Color.from_hsv(0.15, 0.8, 0.1+0.4*(1-dist))
|
|
83
|
+
c.set_pixel(x, y, '═' if y == apse_top else '║', col, z=6)
|
|
84
|
+
|
|
85
|
+
row = apse_top + apse_r * 2 // 3
|
|
86
|
+
for dx_val in range(-int(apse_r*0.5), int(apse_r*0.5)+1, 5):
|
|
87
|
+
px = apse_cy + dx_val
|
|
88
|
+
py = int(row)
|
|
89
|
+
if 0 <= px < w and 0 <= py < h:
|
|
90
|
+
c.set_pixel(px, py, '·', Color(200, 180, 150).mul(0.3), z=7)
|
|
91
|
+
|
|
92
|
+
floor_y = h - 1
|
|
93
|
+
for x in range(w):
|
|
94
|
+
if 0 <= floor_y < h:
|
|
95
|
+
c.set_pixel(x, floor_y, '═', Color(15, 12, 20), z=8)
|
|
96
|
+
|
|
97
|
+
cloud_cols = [(60, 40, 80), (80, 50, 100), (100, 60, 120)]
|
|
98
|
+
for y in range(int(h*0.12)):
|
|
99
|
+
for x in range(w):
|
|
100
|
+
n = math.sin(x*0.02+t*0.3+y*0.1)*0.5+0.5
|
|
101
|
+
if n > 0.65:
|
|
102
|
+
col = Color(cloud_cols[y%3][0], cloud_cols[y%3][1], cloud_cols[y%3][2]).mul((n-0.65)/0.35*0.3)
|
|
103
|
+
c.set_pixel(x, y, '·' if n < 0.8 else '░', col, z=2)
|
demos/scene_aurora.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import math, random
|
|
2
|
+
from spore_engine import *
|
|
3
|
+
from spore_engine.core.color import *
|
|
4
|
+
from spore_engine.sim.noise import PerlinNoise
|
|
5
|
+
|
|
6
|
+
_AURORA = None
|
|
7
|
+
|
|
8
|
+
def scene_aurora(c, hr, t, pt, dt):
|
|
9
|
+
global _AURORA
|
|
10
|
+
if _AURORA is None:
|
|
11
|
+
_AURORA = {
|
|
12
|
+
'noise': PerlinNoise(42),
|
|
13
|
+
'stars': [(random.random(), random.random(), random.random())
|
|
14
|
+
for _ in range(80)],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
w, h = c.w, c.h
|
|
18
|
+
|
|
19
|
+
for y in range(h):
|
|
20
|
+
ty = y / h
|
|
21
|
+
col = Color.from_hsv(0.65 - ty*0.1, 0.4, 0.02 + ty*0.06)
|
|
22
|
+
for x in range(w):
|
|
23
|
+
c.set_pixel(x, y, ' ', bg=col, z=-100)
|
|
24
|
+
|
|
25
|
+
night = 0.8 + 0.2 * math.sin(t * 0.1)
|
|
26
|
+
for sx, sy, phase in _AURORA['stars']:
|
|
27
|
+
px = int(sx * w)
|
|
28
|
+
py = int(sy * h * 0.5)
|
|
29
|
+
if 0 <= px < w and 0 <= py < h:
|
|
30
|
+
tw = 0.5 + 0.5 * math.sin(t * 2 + phase * 100)
|
|
31
|
+
if tw > 0.6:
|
|
32
|
+
b = int(80 + tw * 120 * night)
|
|
33
|
+
c.set_pixel(px, py, '·' if tw < 0.8 else '✦', Color(b, b, int(b*1.1)), z=5)
|
|
34
|
+
|
|
35
|
+
for band in range(5):
|
|
36
|
+
hue_base = 0.7 + band * 0.05 + math.sin(t * 0.02) * 0.05
|
|
37
|
+
for y in range(h // 3):
|
|
38
|
+
gy = int(h * 0.05 + y * 0.6 + band * h * 0.04)
|
|
39
|
+
if gy >= h: continue
|
|
40
|
+
for x in range(w):
|
|
41
|
+
n1 = _AURORA['noise'].noise2(x * 0.02 + t * 0.15, gy * 0.03 + band * 2.0)
|
|
42
|
+
n2 = _AURORA['noise'].noise2(x * 0.04 - t * 0.08, gy * 0.05 + band)
|
|
43
|
+
val = (n1 * 0.6 + n2 * 0.4) * 0.5 + 0.5
|
|
44
|
+
val *= 1.0 - abs(y - h//6) / (h//6)
|
|
45
|
+
val = max(0, min(1, val * 1.5))
|
|
46
|
+
if val > 0.15:
|
|
47
|
+
hue = (hue_base + val * 0.1 + t * 0.005) % 1.0
|
|
48
|
+
bright = 0.2 + val * 0.6
|
|
49
|
+
ch = '░' if val < 0.3 else ('▒' if val < 0.5 else ('▓' if val < 0.7 else '█'))
|
|
50
|
+
c.set_pixel(x, gy, ch, Color.from_hsv(hue, 0.7, bright), z=10)
|
|
51
|
+
|
|
52
|
+
for y in range(h // 2, h):
|
|
53
|
+
ty = (y - h//2) / (h//2)
|
|
54
|
+
for x in range(w):
|
|
55
|
+
n = _AURORA['noise'].noise2(x * 0.05, y * 0.04) * 0.5 + 0.5
|
|
56
|
+
dark = 0.3 + n * 0.7
|
|
57
|
+
c.set_pixel(x, y, ' ', bg=Color(int(3*dark), int(8*dark), int(15*dark)), z=-50)
|