0,]']±>Sï}WÿÍu§ðp8·d%qy)6o;]ÉA¦ösï÷ôôô”°ÂVl†3Sï}WÿÍu§ðp8·d%qy)6o;]ÉA¦ösï÷ôôô”°ÂVl†3b then return b else return x end end function mapget(x,y) if x%256>=128 then return sget( i(x%128), i((y+64)%128+128)--i(clamp(y+map_rect.h/2,0,63)+map_rect.y) ) else return sget( i(x%128), i((y+64)%128)--i(clamp(y+map_rect.h/2,0,63)+map_rect.y) ) end end function rot2(p,t) local c=m.cos(t) local s=m.sin(t) return { x= p.x*c+p.y*s, y=-p.x*s+p.y*c } end function sign(x) return x>0 and 1 or x<0 and -1 or 0 end function s2c(p) local cy=m.cos(p.y) return { x=cy*m.cos(p.x), y=cy*m.sin(p.x), z=m.sin(p.y) } end function c2s(p) return { x=sign(p.y)*m.acos(p.x/m.sqrt(p.x*p.x+p.y*p.y)), y=m.asin(p.z) } end function globe_coord(p,x,y) local p=s2c(p) local p=rot_y(p,y) local p=c2s(p) return {x=p.x+x,y=p.y} end do local tmp_c={x=0,y=0} local r=80.5 local map_rect={x=48,y=0,w=256,h=128} local center={x=120,y=66} local s=44*(pi/2) local smap={x=map_rect.w/(pi/2),y=map_rect.h/(pi/2)} local last_time=0 local map_points={ turku= {x=3.57,y=-1.015}, helsinki= {x=3.62 ,y=-1.01}, bremen= {x=3.315 ,y=-0.83}, berlin= {x=3.45 ,y=-0.835}, saarbruecken={x=3.3 ,y=-0.79}, aarhus= {x=3.33,y=-0.935}, emf= {x=3.075,y=-0.88}, mch= {x=3.23,y=-0.855} } local map_order={"turku","helsinki","bremen","berlin","saarbruecken","aarhus","emf","mch","bremen","berlin","aarhus","emf","mch","helsinki"} local function smoothstep (edge0, edge1, x) local x = clamp((x - edge0) / (edge1 - edge0),0,1) return x * x * x * (x * (6.0 * x - 15.0) + 10.0) end local function interpolate(p1,p2,x) local x=smoothstep(0,1,x) return { x=p1.x*(1.0-x)+(p2.x)*x, y=p1.y*(1.0-x)+(p2.y)*x } end local frame=0 local function draw_globe(center,r,coords) for y=m.max(-i(r),-69)+frame%2,m.min(i(r),69)+frame%2,2 do local w=m.sqrt(r*r-y*y) for x=m.max(-i(w),-121)+frame//2%2,m.min(i(w),121)+frame//2%2,2 do local p=rot2({x=x,y=y}, -0.2) local r0=r*1.2 local z=m.sqrt(r0*r0-(p.x*p.x+p.y*p.y)) local x0=(p.x/r0) x0=m.asin(x0/m.sqrt(x0*x0+z*z)) x0=(x0-x0*0.5)*s local y0=(p.y/r0) y0=m.asin(y0/m.sqrt(y0*y0+z*z)) y0=(y0-y0*0.5)*s local p=globe_coord( {x=x0+0.0001,y=y0}, coords.x, coords.y ) local coord={ x=p.x*(smap.x/4), y=p.y*(smap.y/2) } local c=mapget(coord.x,coord.y) pix(center.x+x,center.y+y,c) end end --circ(center.x,center.y,1,0) end function TIC_world() if btn(0) then tmp_c.y = tmp_c.y-0.005 end if btn(1) then tmp_c.y = tmp_c.y+0.005 end if btn(2) then tmp_c.x = tmp_c.x-0.005 end if btn(3) then tmp_c.x = tmp_c.x+0.005 end vbank(0) cls(0) vbank(1) frame=frame+1 --cls(0) local t=time()/600 --r=50.5--+3*m.sin(t*10) local map_idx0=(i(t))%#map_order+1 local map_idx1=(i(t)+1)%#map_order+1 draw_globe( { x=center.x, y=center.y }, r, --tmp_c interpolate(map_points[map_order[map_idx0]],map_points[map_order[map_idx1]],t%1.0) ) local s = (m.sin(t*10)+1)*3 line(center.x+2+s, center.y-2-s, center.x+10+s, center.y-10-s, 12) line(center.x+2+s, center.y-2-s, center.x+10+s, center.y-2-s, 12) line(center.x+2+s, center.y-2-s, center.x+2+s, center.y-10-s, 12) line(center.x+2+s, center.y+2+s, center.x+10+s, center.y+10+s, 12) line(center.x+2+s, center.y+2+s, center.x+10+s, center.y+2+s, 12) line(center.x+2+s, center.y+2+s, center.x+2+s, center.y+10+s, 12) line(center.x-2-s, center.y-2-s, center.x-10-s, center.y-10-s, 12) line(center.x-2-s, center.y-2-s, center.x-10-s, center.y-2-s, 12) line(center.x-2-s, center.y-2-s, center.x-2-s, center.y-10-s, 12) line(center.x-2-s, center.y+2+s, center.x-10-s, center.y+10+s, 12) line(center.x-2-s, center.y+2+s, center.x-10-s, center.y+2+s, 12) line(center.x-2-s, center.y+2+s, center.x-2-s, center.y+10+s, 12) end end do local i=m.floor local xv=0 local yv=0 local G=0.05 local c={ {x=70,y=50,xv=1.5,yv=0,r=16,c=12}, {x=200,y=60,xv=-0.9,yv=0,r=17,c=12}, {x=20,y=100,xv=0.2,yv=0,r=15,c=12}, {x=26,y=50,xv=-0.5,yv=0,r=12,c=12}, {x=50,y=60,xv=1,yv=0,r=22,c=12}, {x=12,y=20,xv=1.6,yv=0,r=10,c=12}, {x=130,y=100,xv=1.1,yv=0,r=11,c=12} } local function int(c1,c2) return m.sqrt( m.pow(c2.x-c1.x,2)+ m.pow(c2.y-c1.y,2)) 136-c[i].r then c[i].yv=-m.abs(c[i].yv) c[i].y=136-c[i].r elseif c[i].y<0+c[i].r then c[i].yv=m.abs(c[i].yv) c[i].y=0+c[i].r else c[i].yv=c[i].yv+G end if c[i].x<0+c[i].r then c[i].xv=m.abs(c[i].xv) c[i].x=0+c[i].r elseif c[i].x>240-c[i].r then c[i].xv=-m.abs(c[i].xv) c[i].x=240-c[i].r end c[i].x=c[i].x+c[i].xv-xv c[i].y=c[i].y+c[i].yv-yv end end function TIC_balls() t=time()//8 f=m.max(0,(fft(1)+fft(2)+fft(3)-1.0)*3.5) yv=m.cos(t)*f xv=m.sin(t)*f cls(16) updatec() drawc() --for x=-1,1 do for y=-1,1 do --print("vurpo",10+x,10+y,12) --end end --print("vurpo",10,10,16) end end do --greetings to tobach, pumpuli, catnip, jtruk --to polynomial and reality --to joost, nemo, bambie thug, windows95man --and to you! -- vurpo local function f(x) return { x=80*m.cos(x*(7/8))+40*m.sin(x+m.sin(0.9*x)), y=50*m.sin(x*(5/7))+10*m.cos(x+m.cos(1.1*x)) } end local function palette(p) for i=1,#p do poke(0x3fc2+i,p[i]) end end local s="FIELD-FX " local p={ {0x5b,0xce,0xfa,0xf5,0xa9,0xb8,0xff,0xff,0xff}, {0xfc,0xf4,0x34,0xff,0xff,0xff,0x9c,0x59,0xd1,0x2c,0x2c,0x2c}, {0xe4,0x03,0x03,0xff,0x8c,0x00,0xff,0x3d,0x00,0x00,0x80,0x26,0x24,0x40,0x8e,0x73,0x29,0x82}, } local co={ {1,2,3,2,1}, {1,2,3,4}, {1,2,3,4,5,6} } function TIC_floaties() poke(0x3fc0,0) poke(0x3fc1,0) poke(0x3fc2,0) cls(0) t=time()/1000 local p0=m.floor((t/1)%#p+1) palette(p[p0]) local c0=co[p0] for i=0,m.random()*50 do pix(m.random()*240,m.random()*136,c0[i%#c0+1]) end for i=60,0,-1 do local c=f(t*2-i/3+0.3*fft(0,10)) local r=7--3+7*fft(i,i+3) circ(120+c.x,68+c.y,r,c0[i%#c0+1]) print(string.sub(s,i%#s+1,i%#s+1),118+c.x,66+c.y,0) end end end do local c={{100,100,1.5,-1.5,c=3}} local p={ {1,-3},{1,8},{2,13},{5,15},{9,13},{11,8}, {11,5},{11,8},{13,13},{15,15},{18,13}, {19,12},{20,4},{25,4},{25,13},{28,15}, {31,14},{32,13},{33,8},{33,-2},{31,-6}, {20,-7} } local function sign(x) if x<0 then return -1 else return 1 end end local function drawthing(x,y,flip) for i=1,#p-1 do line( x+p[i][1]*flip, y+p[i][2], x+p[i+1][1]*flip, y+p[i+1][2], 0) end circb(x+8*flip,y-21,18,0) circ(x+1*flip,y-21,5,0) circ(x+15*flip,y-21,5,0) circ(x-1*flip,y-22,1.5,12) circ(x+13*flip,y-22,1.5,12) line(x+6*flip,y-11,x+11*flip,y-11,0) end local function len(x,y) return m.sqrt(m.pow(x,2)+m.pow(y,2)) end local function rotscale(p,angle,scale) return { x=scale*(p.x*m.cos(angle)-p.y*m.sin(angle)), y=scale*(p.y*m.cos(angle)+p.x*m.sin(angle)) } end local function drawthings() for i=#c,1,-1 do c[i][1]=c[i][1]+c[i][3] c[i][2]=c[i][2]+c[i][4] c[i][3]=c[i][3]*0.91 c[i][4]=c[i][4]*0.96+0.2 mag=len(c[i][3],c[i][4]) if c[i][4] > 1.8 then table.remove(c,i) else local x=c[i][1] local y=c[i][2] local angle=m.atan2(c[i][4],c[i][3]) local x1=m.abs(c[i][3]) local y1=m.abs(c[i][4]) local m2=m.min(1.1,mag) local p1=rotscale({x=-2-mag,y=-1.8*m2},angle,mag*0.04+0.6) local p2=rotscale({x=-2-mag,y= 1.8*m2},angle,mag*0.04+0.6) local p3=rotscale({x= 2+mag,y=-1.8*m2},angle,mag*0.04+0.6) local p4=rotscale({x= 2+mag,y= 1.8*m2},angle,mag*0.04+0.6) tri( x+p1.x,y+p1.y, x+p2.x,y+p2.y, x+p3.x,y+p3.y, c[i].c) tri( x+p2.x,y+p2.y, x+p3.x,y+p3.y, x+p4.x,y+p4.y, c[i].c) end end end x=0 local function triangle(x) return 2*m.abs(x-m.floor(x+0.5)) end local function r() return m.random()-0.5 end local colors={2,3,4,5,10} local function add(x,y,x2) if #c < 400 then table.insert(c, { x,y, x2*6.5+r()*12, -8.3+r()*7.5, c=colors[m.floor(m.random(1,#colors))] } ) end end function TIC_yippee() t=time()/1000 cls(12) drawthing( 70+100*triangle(t*2.5/m.pi), 100-25*m.abs(m.sin(t*10)), -sign(m.sin(t*5))) if m.random() > 0.7 then for _=1,3 do add( 0+10*r(),140,1) add(240+10*r(),140,-1) add(120+10*r(),140,0) end end drawthings() y=3*m.sin(t*10) print("YIPPEE", 37+100*triangle(t*2.5/m.pi), 35-25*m.abs(m.sin(t*10)), 0, false, 2) end end do local points = { {x=-1,y=-1,z=-1}, {x=-1,y=-1,z= 1}, {x=-1,y= 1,z=-1}, {x=-1,y= 1,z= 1}, {x= 1,y=-1,z=-1}, {x= 1,y=-1,z= 1}, {x= 1,y= 1,z=-1}, {x= 1,y= 1,z= 1} } local lines = { {1,2},{1,3},{4,2},{4,3}, {5,6},{5,7},{8,6},{8,7}, {1,5},{2,6},{3,7},{4,8} } function TIC_cube() cls(0) t=time()/500 local scale = 35+m.sin(t*5)*5 local center = {x=120,y=68} for l=1,#lines do p1=rot_y(rot_x(points[lines[l][1]], t), t) p2=rot_y(rot_x(points[lines[l][2]], t), t) z1=p1.z*0.1+1 z2=p2.z*0.1+1 line( center.x+p1.x*scale*z1, center.y+p1.y*scale*z1, center.x+p2.x*scale*z2, center.y+p2.y*scale*z2, 12) end print_centered("CUBE", 60+6*m.sin(t*10), 12, 2) print_centered("wow!", 73+3*m.sin(t*10), 12, 1) end end function print_centered(text, y, color, scale) local w = print(text, 0, 140, color, false, scale) print(text, 120-(w/2), y, color, false, scale) end function TIC_intro_1() cls(0) t=time()/50 local y=3*m.sin(t) print_centered("vurpo presents", 30+y, 13, 1) print_centered("2023", 50+y, 12, 6) print_centered("was a funny year (and 2024 too so far)", 100+y, 12, 1) end function TIC_intro_2() cls(0) t=time()/50 local y=3*m.sin(t) print_centered("the graphics were too heavy", 40+y, 12, 1) print_centered("for the music to run", 50+y, 12, 1) print_centered("so the soundtrack is separately", 60+y, 12, 1) print_centered("in the music compo", 70+y, 12, 1) print_centered("(oops)", 120+y, 13, 1) end function TIC_intro_3() cls(0) t=time()/50 local y=3*m.sin(t) print_centered("You could have a", 54+y, 12, 1) print_centered("Cocio & Finsprit", 64+y, 4, 1) print_centered("singalong or something?", 74+y, 12, 1) end function TIC_text1() cls(0) t=time()/50 local y=3*m.sin(t) print_centered("Ended up traveling a lot", 54+y, 12, 1) print_centered("...almost planned", 74+y, 12, 1) end function TIC_text2() cls(0) t=time()/50 local y=3*m.sin(t) print_centered("2023: traveled to 5 demoparties", 54+y, 12, 1) print_centered("2024: 4 of them so far...", 74+y, 13, 1) end function TIC_text3() cls(0) t=time()/50 local y=3*m.sin(t) print_centered("participated in 6 bytejams total", 54+y, 12, 1) print_centered("and hosted 2 of them", 74+y, 13, 1) end function TIC_text4() cls(0) t=time()/50 local y=3*m.sin(t) print_centered("Now... check out these", 54+y, 13, 1) print_centered("SICK GFX", 74+y, 12, 4) end function TIC_text5() cls(0) t=time()/50 local y=3*m.sin(t) print_centered("Wow!", 60+y, 12, 4) end function TIC_outro() cls(0) t=time()/50 local y=3*m.sin(t) print_centered("Thank you to Violet,", 44+y, 12, 1) print_centered("who got me into this whole mess", 54+y, 12, 1) print_centered("Greetings to all of you!", 64+y, 12, 1) print_centered("And see you at future parties too!", 84+y, 12, 1) end function BOOT() music(1,0,0,false,false,320,6) end scenes={ intro1={s=0,f=TIC_intro_1}, intro2={s=0,f=TIC_intro_2}, intro3={s=0,f=TIC_intro_3}, train={s=0,f=TIC_train}, world={s=1,f=TIC_world}, balls={s=0,f=TIC_balls}, floaties={s=0,f=TIC_floaties}, yippee={s=0,f=TIC_yippee}, cube={s=0,f=TIC_cube}, text1={s=0,f=TIC_text1}, text2={s=0,f=TIC_text2}, text3={s=0,f=TIC_text3}, text4={s=0,f=TIC_text4}, text5={s=0,f=TIC_text5}, outro={s=0,f=TIC_outro} } sequence = { {i="intro1",t=5}, {i="intro2",t=4}, {i="intro3",t=2}, {i="world",t=3}, {i="text1",t=3}, {i="world",t=3}, {i="text2",t=3}, {i="world",t=3}, {i="text3",t=3}, {i="world",t=7}, {i="text4",t=5}, {i="cube",t=8}, {i="balls",t=8}, {i="train",t=10}, {i="yippee",t=8}, {i="floaties",t=8}, {i="text5",t=5}, {i="cube",t=1}, {i="balls",t=1}, {i="train",t=1}, {i="yippee",t=1}, {i="floaties",t=1}, {i="cube",t=1}, {i="balls",t=1}, {i="train",t=1}, {i="yippee",t=1}, {i="floaties",t=1}, {i="cube",t=0.5}, {i="balls",t=0.5}, {i="train",t=0.5}, {i="yippee",t=0.5}, {i="floaties",t=0.5}, {i="outro",t=100} } idx = 1 scenestart = 0 function TIC() local t=time()/1000 --idx = m.floor(t%#sequence+1) scenename = sequence[idx].i if t-scenestart > sequence[idx].t then idx = idx+1 idx = m.min(idx, #sequence) vbank(1) cls(0) vbank(0) cls(0) default_palette() scenestart = time()/1000 end sync(3,scenes[scenename].s) scenes[scenename].f() -- print(t,10,10,12) -- print(scenestart,10,20,12) -- print(idx,10,30,12) end