ktulho 5,790 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 Share this post Link to post Short link Share on other sites
ktulho 5,790 #477039 Posted February 9, 2020 Поправил скрипт в шапке. 3 Quote Share this post Link to post Short link Share on other sites
SEREGA_SF 611 #477062 Posted February 9, 2020 Красота. А с учетом того, что можно и свои картинки заюзать - вообще чего хошь можно натворить) Quote Share this post Link to post Short link Share on other sites
StranikS_Scan 4,210 #477070 Posted February 9, 2020 Да, смотрится хорошо! Quote Share this post Link to post Short link Share on other sites
Scharfhobel 216 #477071 Posted February 9, 2020 (edited) 5 часов назад, ktulho сказал: Поправил скрипт в шапке. спс., всё завелось Edited February 9, 2020 by Scharfhobel Quote Share this post Link to post Short link Share on other sites
ktulho 5,790 #477093 Posted February 9, 2020 А если воспользоваться аддоном События по таймеру, то можно добавить подобие маятника: 2 Quote Share this post Link to post Short link Share on other sites
SEREGA_SF 611 #477095 Posted February 9, 2020 @ktulho, осталось кукушку запилить Quote Share this post Link to post Short link Share on other sites
Scharfhobel 216 #477116 Posted February 9, 2020 7 часов назад, ktulho сказал: А если воспользоваться аддоном События по таймеру, то можно добавить подобие маятника: ок, а как хвостик (противовес) у секундной стрелки добавить? Quote Share this post Link to post Short link Share on other sites
ktulho 5,790 #477150 Posted February 10, 2020 17 часов назад, Scharfhobel сказал: , а как хвостик (противовес) у секундной стрелки добавить? К сожалению, параметр "rotation" вращает вокруг левого верхнего угла картинки, поэтому никак. Quote Share this post Link to post Short link Share on other sites
ktulho 5,790 #477151 Posted February 10, 2020 (edited) Хотя я тут подумал. Если для "хвостика" использовать еще одну картинку, то наверное получиться. Edited February 10, 2020 by ktulho Quote Share this post Link to post Short link Share on other sites
Scharfhobel 216 #477152 Posted February 10, 2020 точно! и вращать ее со сдвигом на 180 градусов 1 Quote Share this post Link to post Short link Share on other sites
SEREGA_SF 611 #477202 Posted February 11, 2020 Спасибо Саш за классное дополнение, для себя сделал в нашем урфошном стиле: 1 Quote Share this post Link to post Short link Share on other sites
Scharfhobel 216 #477215 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 Share this post Link to post Short link Share on other sites
ktulho 5,790 #477220 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 Share this post Link to post Short link Share on other sites
Scharfhobel 216 #477244 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 Share this post Link to post Short link Share on other sites
BuSH 174 #485410 Posted July 19, 2020 08.02.2020 в 23:42, ktulho сказал: Решил для разнообразия сделать аналоговые часы. Следующие часы из кривых, BW шными векторами или тупо на твинлайте будешь делать? ) Или уже... Quote Share this post Link to post Short link Share on other sites
Fyodor 15 #533927 Posted April 7, 2023 тема еще работает Quote Share this post Link to post Short link Share on other sites