Home > Fun, Web Code, Work > Ansca Corona + Lua = iPhone Application

Ansca Corona + Lua = iPhone Application

January 7th, 2010

ansca corona analog clock iphone application

Today I built a nice looking iPhone application (an analog clock) and managed to build it in a language that I had never seen before in just an hour or so. This feat was entirely because of how simple the folks at Ansca have made programming for the iPhone.

As for the Lua language, it isn’t half bad. I groaned a few times as I looked up simple things (like how to concatenate text – which is ‘..’ btw). The only thing I struggled with was how to specify a font, which I couldn’t find any documentation for, and eventually gave up on. Perhaps I’ll figure it out tomorrow.

I may expand this post a little tomorrow, as soon as I work on acquiring image rights for the background and clock face.

Ansca Corona Lua iPhone Application Analog Clock

Fun, Web Code, Work

  1. January 9th, 2010 at 14:32 | #1

    Nice clock!

    Regarding fonts, v1.0 doesn’t support font selection, but we just announced Corona 1.1 for later this month, which will have a lot of new features for text input/output, along with integration tools for Facebook and Twitter, and GPS/compass support. Feel free to email or ask on our forums if you have further questions or problems!

  2. January 9th, 2010 at 22:42 | #2

    Wow! A comment from the company that makes the software! Again, I love this product.

    This probably says it all… it’s 9pm on a Saturday night and I’m happily at home, listening to the Engadget podcast, and integrating purchased stock imagery into my Corona-built iPhone app. The Ansca forums are great, and I’ve found a bunch of very useful sample code in there.

  3. January 10th, 2010 at 15:44 | #3

    Feel free to post, or email feedback or any other suggestions/amplifications that you think may be beneficial to make our product better.

    Carlos

  4. Alex
    June 28th, 2010 at 16:02 | #4

    Any chance you could post a link to the background? I was wanting to use it for a personal project.

  5. Danny Reus
    June 30th, 2010 at 14:43 | #5

    Hello Christopher,

    Love the layout of the application.
    How did you make the clock, by code or with an image?
    I am starting with lua, can you help me how you did the angles for the clock?

    Thanks in advance,

    Danny

  6. June 30th, 2010 at 14:56 | #6

    The clock, in it’s most basic form, is made up of 5 images in the following layering order:

    Background image (opaque rectangle the same size as the screen)
    Clock face (square semi-transparent PNG – width and height = screen width)
    Clock hour hand (square semi-transparent PNG – width and height = screen width)
    Clock minute hand (square semi-transparent PNG – width and height = screen width)
    Clock second hand (square semi-transparent PNG – width and height = screen width)

    All the square images share the same screen coordinates. The hour, minute and seconds hand images are rotated on their center point to reflect the correct time. The code to do this is quite small. I’ve since added a bunch of user preferences and the code has gone from a few dozen lines to a lot more.
    -Chris

  7. June 30th, 2010 at 14:59 | #7

    I believe that I got the image from the stock.xchng doing a search on backgrounds. There are nicer background on iStock photo but you may have to page a few dollars for those. It looks like I touched it up slightly in Photoshop.

  1. No trackbacks yet.