equal
deleted
inserted
replaced
|
1 // widget_animate.ysl2 |
|
2 |
|
3 template "widget[@type='Animate']", mode="widget_class"{ |
|
4 || |
|
5 class AnimateWidget extends Widget{ |
|
6 frequency = 5; |
|
7 speed = 0; |
|
8 |
|
9 dispatch(value) { |
|
10 this.speed = value; |
|
11 |
|
12 //reconfigure animation |
|
13 this.request_animate(); |
|
14 } |
|
15 |
|
16 animate(){ |
|
17 // change animation properties |
|
18 this.element.children[0].setAttribute("dur", String(this.speed)+"s") |
|
19 } |
|
20 |
|
21 init() { |
|
22 let width = this.element.getAttribute("width"); |
|
23 let height = this.element.getAttribute("height"); |
|
24 this.element.setAttribute("x",width/-2); |
|
25 this.element.setAttribute("y",height/-2); |
|
26 } |
|
27 } |
|
28 || |
|
29 } |
|
30 |
|
31 |
|
32 template "widget[@type='Animate']", mode="widget_defs" { |
|
33 param "hmi_element"; |
|
34 |, |
|
35 } |