Home AMX User Forum AMX Design Tools

Sticky one - Ideas for an analog clock?

Hi everyone. I know this one is probaly not worth the work it takes, but anyways, since this week I haven't had anything to do, I was wondering if it is possible to create, somehow, an analog clock on a tp. I know I can draw 60 images to represent the minutes and other 12 to represent the hours, but ain't there an easier way? If I could, somehow, rotate an image, this would be easy. But as far as I know, that is not possible, is it?

Thanks.

Comments

  • Spire_JeffSpire_Jeff Posts: 1,917
    It is not possible (to my knowledge) to manipulate graphics in the manner you are describing on the panel itself. The is a tech note (http://amx.com/techsupport/techNote.asp?id=592) that has an example analog clock.

    Jeff

    P.S.
    You could use something like the scripting in Photoshop to automate making the clock graphics.
  • DHawthorneDHawthorne Posts: 4,584
    It is, however, relatively easy to rotate an image in Photoshop, or your editor of choice. I would make two (three if you want a second hand) bargraph buttons, and assign the rotated images to each; put your background on the hour hand, and make the others transparent. Then just send the level to each "hand" and you are done.
  • DiogoDiogo Posts: 65
    I like it the "I have nothing to do"

    I guess if a future revision of TPdesign have a way to draw lines, that could be moved by netlinx code,
    this could be much easy, until that, photoshop and Ctrl + T :)
    You could copy some clock example with vista/mac os dashboard and make equal at the TP.
  • viningvining Posts: 4,368
    DHawthorne wrote:
    It is, however, relatively easy to rotate an image in Photoshop, or your editor of choice.
    Yes, but staying true to center can be a pain. I once made a 4 bladed panel fan for a floor plan view that would rotate and change speeds as the Lutron feedback changed and the hardest part of it all was getting the wobble out of the animation.

    Sure, if I was a little smarter or knew what I was doing at the time it might have been easier but it seems I don't figure out the easy way until I'm done with what I'm attempting and then it's too late.
  • ericmedleyericmedley Posts: 4,177
    I've been working on one for a project I'm doing right now. I'm still tweaking it but I'll post it for anyone who wants to use it.

    It involves 2-3 animated faders with 60 steps each. Hours - Miniutes -seconds. I've made it so you can skip the seconds if you wish. The second and minute hand have the spindal graphic. Also, you need to add a button with the back of the clock and if you want a cyrstal (glass) over the clock you have to add another button over the top of all of it.

    So if you you're looking at this mess from the side, here are the layers

    Crystal
    Seconds
    Hours
    Minutes
    Clock Back

    Hours are divided up into 60 parts so you'll need to do the math to make that part work.

    Minutes and seconds are fairly obvious.

    It looks like this when done.

    I'll also give you the Photoshop file if you want to make some other clocks or change the size. Good luck exporting the hour/mintue/second hadn stuff. It's boring and a bear...
  • viningvining Posts: 4,368
    Nice clock!
  • PhreaKPhreaK Posts: 966
    ericmedley wrote: »
    Hours are divided up into 60 parts so you'll need to do the math to make that part work.

    I may be missing something but is there any reason you can't just make the hour multistate bargraph have only 12 states, then just pass you time info directly to the relevant levels?
  • ericmedleyericmedley Posts: 4,177
    PhreaK wrote: »
    I may be missing something but is there any reason you can't just make the hour multistate bargraph have only 12 states, then just pass you time info directly to the relevant levels?


    On a standard analog clock the hour hand does move between the hours. So for example when the time is 2:30 the hour hand is midway between the 2 and the 3. After viewing my clock I could probably see the purist trying to put more states in since the hour hand seems to jump instead of move more smoothily.

    I'll be posting it soon and you all can try it out for yourselves.
  • ericmedleyericmedley Posts: 4,177
    Okay, here it is.

    I've included all the stuff you'd need to make it yourself to. I made pretty simple clock hands for this sample. It's much easier to create the different positions of the hands in a 3D amination program. But you can do it just fine with Photoshop.

    To move the hand from one second/minute just select the layer of the hand and then rotate it by 6 degrees. You'll need to reposition the center of the hand with the spindle. Expoert, wash rinse repeeat...


    Be careful not to move the guide layer.

    The clock is made with 3 multi-state levels. In this example level 1 is hours. level 2 - minutes and level 3 seconds.

    minutes and seconds are simple enough. just send the numberic value of the second and/or minute to the level and it'll work.

    Hours is a little more complicated. Here's the formula to make that work. My version doesn't round. I honestly don't care that much. But you may want to round the calculation to get a more honest looking hour hand.
    send_level dev_AW_TP_01,3,SECOND_CURR // second hand
    	send_level dev_AW_TP_01,2,MINUTE_CURR // minute Hand
    	if(HOUR_CURR<13)
    		{
    		send_level dev_AW_TP_01,1,(((HOUR_CURR)*60)/12 )+ ((MINUTE_CURR*5)/60)   // hour hand
    		}
    	else
    		{
    		send_level dev_AW_TP_01,1,(((HOUR_CURR-12)*60)/12 )+ ((MINUTE_CURR*5)/60)  // hour hand
    		}
    

    Have fun.
    e


    PS: Okay, it appears that I cannot upload the file to the website. Must be too big or something. I'll put it on my website.

    http://www.ericmedley.com/analog_clock.zip right-click and save as.
  • jp1016jp1016 Posts: 32
    Thank you all =]
    ericmedley, I'm changing the background of the clock and all use it on my projects. I liked it very much man. The hard part was to draw the clock's arms, and since you did it and you don't mind we use it, we'll do it =]

    Thanks for the effort
  • PhreaKPhreaK Posts: 966
    ericmedley wrote: »
    On a standard analog clock the hour hand does move between the hours.

    Thought that might have been the case. Shows how often I use analog clocks :)
Sign In or Register to comment.