Super small demo

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
retrotails
Party member
Posts: 212
Joined: Wed Apr 18, 2012 12:37 am

Super small demo

Post by retrotails »

I got bored.

Code: Select all

q=love g=q.graphics m=math function q.load()l={};t=0 end function q.update(d)t=t+d end function q.draw()for i=1,75 do x=m.sin(t+i)*64 c=128-64*(m.sin(t+i)-m.sin(t+i+1))g.setColor(c,c,c,128)g.circle('fill',x+400,i*8,8,8)g.setColor(c,c,c,128)g.circle('fill',x+398,i*8-2,4,8)l[i*2-1]=x+400 l[i*2]=i*8 end g.line(l)end
I made this for part of my picross intro and figured it could stand alone, squished into 314 bytes. It looks so intimidating, despite the simple original code (that does a few more things)

Code: Select all

    for i = 1,screen.h/8 do
        local x = math.sin(game.timer + i) * 64
        local color = 128 - 64*(math.sin(game.timer + i) - math.sin(game.timer + i + 1))
        love.graphics.setColor(color, color, color, 128)
        love.graphics.circle('fill', x + screen.w/2, i*8, 8, 8)
        love.graphics.setColor(color, color, color, 128)
        love.graphics.circle('fill', x + screen.w/2 - 2, i*8 - 2, 4, 8)
        tmp[i*2-1] = x + screen.w/2
        tmp[i*2] = i*8
    end
    love.graphics.setColor(128, 128, 192)
    love.graphics.line(tmp)
    love.graphics.setColor(255, 255, 255)
Feel free to post your own, I want to see what others can make.
User avatar
master both
Party member
Posts: 262
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Super small demo

Post by master both »

That looks so good!
User avatar
buhb11
Citizen
Posts: 81
Joined: Wed Dec 26, 2012 8:59 pm

Re: Super small demo

Post by buhb11 »

Nice :)
I found Love very enjoyable and nice!
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Super small demo

Post by Robin »

I managed to reduce it to 268 bytes.

For some reason, my .love is larger than yours, even though the main.lua is 46 bytes smaller. Oh well.
Attachments
helix-robin.love
(365 Bytes) Downloaded 158 times
Help us help you: attach a .love.
User avatar
retrotails
Party member
Posts: 212
Joined: Wed Apr 18, 2012 12:37 am

Re: Super small demo

Post by retrotails »

Robin wrote:I managed to reduce it to 268 bytes.

For some reason, my .love is larger than yours, even though the main.lua is 46 bytes smaller. Oh well.
I thought about doing all that but searching for when making a global saved space seemed too time consuming. Also I wouldn't have thought to make 255 a global constant.
Anyway, this is an interesting illusion - Look at the right half and it appears to move up, look to the left and it appears to move left, and you can also see it moving up and left diagonally. It also appears to get brighter if you stare at it as a whole.
Or maybe I'm stoned and don't remember getting stoned.

Code: Select all

n=255 a=32 l=love g=l.graphics m=math function l.load()t=0 end function l.update(d)t=t+d end function l.draw()for x=0,25 do for y=0,19 do g.setColor(n,n,n,m.sin(m.mod((x+y+t*8)/8,1))*n)g.rectangle('fill',x*a,y*a,a,a)end end end
This is the best time waster at high school, it seems.
not getting stoned. i dont do drugs of any kind.
The .love is bigger then the contents - I'm on a school XP desktop right now but when I compressed my other one I was at home on Linux. Maybe this is why your .love was larger then mine, Robin.
User avatar
vitaminx
Citizen
Posts: 95
Joined: Fri Oct 19, 2012 7:16 am
Location: international
Contact:

Re: Super small demo

Post by vitaminx »

saved some characters in your boxes.love, now down to 198 bytes:

Code: Select all

n=255 a=32 t=0 l=love g=l.graphics function l.update(d)t=t+d end function l.draw()for x=0,25 do for y=0,19 do g.setColor(n,n,n,math.sin(((x+y+t*8)/8)%1)*n)g.rectangle('fill',x*a,y*a,a,a)end end end
also the zip size is smaller now, compressing with "zip -9X" on Linux results in a 266 bytes zip file.
Attachments
boxes_tiny.zip
(266 Bytes) Downloaded 118 times
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: Super small demo

Post by Santos »

These are super cool! The boxes illusion is really interesting. I think I even saw it moving diagonally down and right, but like, as if it were really really fast and losing frames. I may be crazy.

Further advancements! :rofl:

Helix:

Code: Select all

q=love g=q.graphics C=g.circle S=g.setColor m=math.sin l={}t=0 h=128 f='fill'function q.draw()t=t+q.timer.getDelta()for i=1,75 do x=m(t+i)*64 c=h-x+64*m(t+i+1)S(c,c,c,h)C(f,x+400,i*8,8,8)S(c,c,c,h)C(f,x+398,i*8-2,4,8)l[i*2-1]=x+400 l[i*2]=i*8 end g.line(l)end
Boxes:

Code: Select all

n=255 a=32 t=0 l=love g=l.graphics function l.draw()t=t+l.timer.getDelta()for x=0,25 do for y=0,19 do g.setColor(n,n,n,math.sin(((x+y+t*8)/8)%1)*n)g.rectangle('fill',x*a,y*a,a,a)end end end
Here's something based on this: http://sol.gfxile.net/gp/ch02.html
image.png
image.png (35.64 KiB) Viewed 2920 times

Code: Select all

t=0 l=love g=l.graphics a=256 g.setMode(a,a)function l.draw()t=t+l.timer.getDelta()*99 for x=0,a do for y=0,a do g.setColor(0,x*x+y*y+t,99)g.point(x,y) end end end
Attachments
gp.love
(285 Bytes) Downloaded 133 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest