Tiny Code Christmas - Day 4 - EXTRA

Welcome to Day 4 of Tiny Code Christmas EXTRA! We’re glad that you’re joining us again on this festive journey into the world of sizecoding. TCC Extra is intended for people who completed Tiny Code Christmas last year and want a new challenge!

If you haven’t already, read the overview to find out what Tiny Code Christmas is all about!

The Challenge: Roto!

The challenge is to make the smallest implementation you can of the effect while keeping the center of rotation moving, there’s lots of room for improvement in the code! Check it out below.

TIC-80

function TIC()
 t=time()/999 

 for x=0,239 do
 for y=0,135 do
  --center of rotation
  x1=x-120+math.sin(t)*120
  y1=y-68 +math.sin(t)*68
  --rotate around angle t
  u=math.cos(t)*x1-math.sin(t)*y1
  v=math.sin(t)*x1+math.cos(t)*y1
  --plot color based on rotated coords
  pix(x,y,(u//1&v//1)/5)
 end
 end
end

PICO-8

function _draw()
 t=time()/10

 for n=0,2150 do
  x=rnd(128)
  y=rnd(128)
  --center of rotation
  x1=x-64+sin(t)*64
  y1=y-64+sin(t)*64
  --rotate around angle t
  u=cos(t)*x1-sin(t)*y1
  v=sin(t)*x1+cos(t)*y1
  --plot color based on rotated coords
  pset(x,y,(u&v)/10)

 end
end

Sharing is Caring!

If you feel like it, why not share what you’ve done with us on the LoveByte Discord, #lovebyte on IRCnet, or share on Twitter and Mastodon using the hashtag #lovebytetcc