Jump to content
Korean Random

Аналоговые часы.


Recommended Posts

Решил для разнообразия сделать аналоговые часы.

 

clock.gif.b317b9d7b0153840c544343efa29956d.gif

 

Подключение:

1) В файл widgets.xc добавить:

${ "widgetsTemplates.xc":"analogWatch" }

2) в widgetsTemplates.xc добавить:

  "analogWatch": {
    "enabled": true,
    "layer": "normal",
    "type": "extrafield",
    "formats": [
      {
        "width": 152,
        "height": 152,
        "x": 450,
        "y": 150,
        "format": "<img src='xvm://res/AnalogWatch/CABg.png'>"
      },
      {
        "updateEvent": "ON_EVERY_SECOND",
        "rotation": "{{py:xvm.hourHand}}",
        "width": 77,
        "height": 77,
        "x": 527,
        "y": 227,
        "format": "<img src='xvm://res/AnalogWatch/CAH.png'>"
      },
      {
        "updateEvent": "ON_EVERY_SECOND",
        "rotation": "{{py:xvm.minuteHand}}",
        "width": 77,
        "height": 77,
        "x": 527,
        "y": 227,
        "format": "<img src='xvm://res/AnalogWatch/CAM.png'>"
      },
      {
        "updateEvent": "ON_EVERY_SECOND",
        "rotation": "{{py:xvm.secondHand}}",
        "width": 77,
        "height": 77,
        "x": 527,
        "y": 227,
        "format": "<img src='xvm://res/AnalogWatch/CAS.png'>"
      },
      {
        "width": 12,
        "height": 12,
        "x": 520,
        "y": 220,
        "format": "<img src='xvm://res/AnalogWatch/center.png'>"
      }

    ]
  }

3) распаковать архив AnalogWatch.zip в \res_mods\mods\shared_resources\xvm\res\

AnalogWatch.zip

4) Скопировать скрипт в analogWatch.py в \res_mods\configs\xvm\py_macro\

analogWatch.py

 

Edited by ktulho
  • Upvote 14
Link to comment
Short link
Share on other sites

17 часов назад, Scharfhobel сказал:

, а как хвостик (противовес) у секундной стрелки добавить?

К сожалению, параметр "rotation" вращает вокруг левого верхнего угла картинки, поэтому никак.

Link to comment
Short link
Share on other sites

добавить в analogWatch.py ?

@xvm.export('xvm.tailSecondHand', deterministic=False)
def xvm_formatDate():
    d = datetime.now()
    return degrees(d.second / 30.0 * pi) + 45	

и в widgetsTemplates.xc добавить: ?

      {
        "updateEvent": "ON_EVERY_SECOND",
        "rotation": "{{py:xvm.tailSecondHand}}",
        "width": 77,
        "height": 77,
        "x": 527,
        "y": 227,
        "format": "<img src='xvm://res/AnalogWatch/CAST.png'>"
      },

и картинку CAST с хвостиком нарисовать и добавить?

CAST.png

Edited by Scharfhobel
Link to comment
Short link
Share on other sites

  • 5 months later...
08.02.2020 в 23:42, ktulho сказал:

Решил для разнообразия сделать аналоговые часы.

Следующие часы из кривых, BW шными векторами или тупо на твинлайте будешь делать? )  Или уже... 

Link to comment
Short link
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...