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'
', unsafe_allow_html=True ) st.markdown("---") st.caption("Made with love, regret, and way too much numpy")