ktulho Posted February 8, 2020 Share Posted February 8, 2020 (edited) Решил для разнообразия сделать аналоговые часы. Подключение: 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 February 9, 2020 by ktulho 14 @ Quote Link to comment Short link Share on other sites More sharing options...
ktulho Posted February 9, 2020 Author Share Posted February 9, 2020 Поправил скрипт в шапке. 3 @ Quote Link to comment Short link Share on other sites More sharing options...
SEREGA_SF Posted February 9, 2020 Share Posted February 9, 2020 Красота. А с учетом того, что можно и свои картинки заюзать - вообще чего хошь можно натворить) @ Quote Link to comment Short link Share on other sites More sharing options...
StranikS_Scan Posted February 9, 2020 Share Posted February 9, 2020 Да, смотрится хорошо! @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted February 9, 2020 Share Posted February 9, 2020 (edited) 5 часов назад, ktulho сказал: Поправил скрипт в шапке. спс., всё завелось Edited February 9, 2020 by Scharfhobel @ Quote Link to comment Short link Share on other sites More sharing options...
ktulho Posted February 9, 2020 Author Share Posted February 9, 2020 А если воспользоваться аддоном События по таймеру, то можно добавить подобие маятника: 2 @ Quote Link to comment Short link Share on other sites More sharing options...
SEREGA_SF Posted February 9, 2020 Share Posted February 9, 2020 @ktulho, осталось кукушку запилить @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted February 9, 2020 Share Posted February 9, 2020 7 часов назад, ktulho сказал: А если воспользоваться аддоном События по таймеру, то можно добавить подобие маятника: ок, а как хвостик (противовес) у секундной стрелки добавить? @ Quote Link to comment Short link Share on other sites More sharing options...
ktulho Posted February 10, 2020 Author Share Posted February 10, 2020 17 часов назад, Scharfhobel сказал: , а как хвостик (противовес) у секундной стрелки добавить? К сожалению, параметр "rotation" вращает вокруг левого верхнего угла картинки, поэтому никак. @ Quote Link to comment Short link Share on other sites More sharing options...
ktulho Posted February 10, 2020 Author Share Posted February 10, 2020 (edited) Хотя я тут подумал. Если для "хвостика" использовать еще одну картинку, то наверное получиться. Edited February 10, 2020 by ktulho @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted February 10, 2020 Share Posted February 10, 2020 точно! и вращать ее со сдвигом на 180 градусов 1 @ Quote Link to comment Short link Share on other sites More sharing options...
SEREGA_SF Posted February 11, 2020 Share Posted February 11, 2020 Спасибо Саш за классное дополнение, для себя сделал в нашем урфошном стиле: 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted February 11, 2020 Share Posted February 11, 2020 (edited) добавить в 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 с хвостиком нарисовать и добавить? Edited February 11, 2020 by Scharfhobel @ Quote Link to comment Short link Share on other sites More sharing options...
ktulho Posted February 12, 2020 Author Share Posted February 12, 2020 @Scharfhobel можно просто: { "updateEvent": "ON_EVERY_SECOND", "rotation": "{{py:sum({{py:xvm.secondHand}}, 180)}}", "width": 77, "height": 77, "x": 527, "y": 227, "format": "<img src='xvm://res/AnalogWatch/CAST.png'>" }, 2 @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted February 12, 2020 Share Posted February 12, 2020 5 часов назад, ktulho сказал: @Scharfhobel можно просто: { "updateEvent": "ON_EVERY_SECOND", "rotation": "{{py:sum({{py:xvm.secondHand}}, 180)}}", "width": 77, "height": 77, "x": 527, "y": 227, "format": "<img src='xvm://res/AnalogWatch/CAST.png'>" }, Yes! @ Quote Link to comment Short link Share on other sites More sharing options...
BuSH Posted July 19, 2020 Share Posted July 19, 2020 08.02.2020 в 23:42, ktulho сказал: Решил для разнообразия сделать аналоговые часы. Следующие часы из кривых, BW шными векторами или тупо на твинлайте будешь делать? ) Или уже... @ Quote Link to comment Short link Share on other sites More sharing options...
Fyodor Posted April 7, 2023 Share Posted April 7, 2023 тема еще работает @ Quote Link to comment Short link Share on other sites More sharing options...
Recommended Posts
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.