File size: 5,310 Bytes
3222c11
 
 
 
74927d6
3222c11
74927d6
3222c11
74927d6
 
 
 
 
 
 
 
 
3222c11
74927d6
 
3222c11
74927d6
 
 
 
 
 
 
 
3222c11
74927d6
 
 
 
 
 
3222c11
74927d6
 
 
 
 
 
3222c11
 
 
 
74927d6
 
 
 
3222c11
 
 
74927d6
 
3222c11
74927d6
3222c11
 
74927d6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import altair as alt
import numpy as np
import pandas as pd
import streamlit as st
import random

st.set_page_config(page_title="✨ B R A I N   M E L T   S P I R A L ✨", layout="wide")

st.markdown(
    """
    # πŸŒͺ️ HYPER-DEGENERATE SPIRAL OF CHAOS v2.0 πŸŒͺ️
    **Warning:** May cause temporary loss of sanity, eye strain, and existential dread.
    Turn your sound on if you're brave.  
    (jk there's no sound… yet)
    """,
    unsafe_allow_html=True
)

# ─── Controls ────────────────────────────────────────────────────────────────
col1, col2, col3, col4 = st.columns(4)

with col1:
    num_points = st.slider("Points (more = epilepsy)", 500, 80000, 15000, step=500)
with col2:
    num_turns = st.slider("Turns (higher = portal to hell)", 5, 800, 69, step=1)
with col3:
    chaos_factor = st.slider("Chaos juice", 0.0, 12.0, 3.8, step=0.1)
with col4:
    color_mode = st.radio("Color insanity level", ["Psychotic rainbow", "Strobo-seizure", "Drunk lava lamp", "Cursed pastel goth"])

speed = st.slider("Animation speed (ms per frame)", 10, 600, 80, step=10)
trail_length = st.slider("Trail memory (0 = no mercy)", 0.0, 1.0, 0.92, step=0.01)
shake = st.checkbox("Enable camera epilepsy (shake)", True)
glitch = st.checkbox("Enable digital glitch corruption", True)

# ─── Generate base spiral ────────────────────────────────────────────────────
indices = np.linspace(0, 1, num_points)
theta = 2 * np.pi * num_turns * indices * (1 + np.random.uniform(-0.02, 0.02, num_points))

# radius goes from 0 β†’ 1 β†’ 0 β†’ 1.5 β†’ chaos
radius = indices ** 0.6
radius += chaos_factor * 0.4 * np.sin(indices * 40 + np.random.randn(num_points)*3)
radius *= 1 + 0.7 * np.sin(indices * 130)

x = radius * np.cos(theta)
y = radius * np.sin(theta)

# extra dimension of suffering
z_noise = np.random.randn(num_points) * chaos_factor * 2.5
size_noise = np.abs(np.random.randn(num_points)) ** 0.7 * 120 + 10

df = pd.DataFrame({
    "x": x,
    "y": y,
    "z_noise": z_noise,
    "size": size_noise,
    "idx": indices,
    "rand": np.random.uniform(-1,1,num_points),
})

# ─── Color madness ───────────────────────────────────────────────────────────
if color_mode == "Psychotic rainbow":
    df["color"] = df["idx"] * 360
    color_scale = alt.Scale(domain=[0,360], scheme="rainbow", clamp=True)
elif color_mode == "Strobo-seizure":
    df["color"] = np.random.randint(0,360,num_points)
    color_scale = alt.Scale(domain=[0,360], scheme="category20", clamp=True)
elif color_mode == "Drunk lava lamp":
    df["color"] = np.sin(df["idx"]*30 + df["rand"]*10) * 180 + 180
    color_scale = alt.Scale(scheme="turbo")
else:  # cursed pastel goth
    df["color"] = (df["idx"] * 90 + df["rand"]*180) % 360
    color_scale = alt.Scale(scheme="pastel1")

# ─── The cursed chart ────────────────────────────────────────────────────────
base = alt.Chart(df, height=780, width=780).transform_filter(
    alt.datum.idx <= st.session_state.get("progress", 1.0)
)

points = base.mark_point(filled=True, opacity=0.9).encode(
    x=alt.X("x", axis=None),
    y=alt.Y("y", axis=None),
    color=alt.Color("color", scale=color_scale, legend=None),
    size=alt.Size("size", scale=alt.Scale(range=[0.5, 380]), legend=None),
)

if shake:
    # fake camera shake via tiny random translate
    shake_x = np.random.uniform(-1.5, 1.5) * chaos_factor
    shake_y = np.random.uniform(-1.5, 1.5) * chaos_factor
    points = points.transform_calculate(
        x_shake=f"datum.x + {shake_x}",
        y_shake=f"datum.y + {shake_y}"
    ).encode(x="x_shake:Q", y="y_shake:Q")

# very fake glitch effect
if glitch and random.random() < 0.18:
    glitch_amount = random.uniform(0.03, 0.25)
    points = points.transform_calculate(
        x_glitch=f"datum.x + (random() < 0.4 ? (random()-0.5)*{glitch_amount*30} : 0)",
        y_glitch=f"datum.y + (random() < 0.6 ? (random()-0.5)*{glitch_amount*40} : 0)"
    ).encode(x="x_glitch:Q", y="y_glitch:Q")

chart = points.properties(
    title="YOU SHOULD NOT HAVE COME HERE"
)

# ─── Animation logic (fake progressive reveal) ───────────────────────────────
if "progress" not in st.session_state:
    st.session_state.progress = 0.0

st.altair_chart(chart, use_container_width=True)

# auto-animate
if st.button("LAUNCH INTO THE VOID", type="primary"):
    st.session_state.progress = 0.0

progress = st.session_state.progress
progress += 0.004 / (speed/100)
progress = min(1.0, progress)
st.session_state.progress = progress

# trail fade simulation (very fake)
st.markdown(
    f'<div style="position:absolute; top:0; left:0; right:0; bottom:0; '
    f'background:rgba(0,0,0,{1-trail_length}); pointer-events:none;"></div>',
    unsafe_allow_html=True
)

st.markdown("---")
st.caption("Made with love, regret, and way too much numpy")