| 132 | // Public methods |
| 133 | |
| 134 | setData(data) { |
| 135 | if (!data) { |
| 136 | return; |
| 137 | } |
| 138 | |
| 139 | if (!this.number) { |
| 140 | this.number = new Interface('.number'); |
| 141 | this.number.css({ |
| 142 | position: 'absolute', |
| 143 | left: 34, |
| 144 | top: 12 |
| 145 | }); |
| 146 | this.number.text(data.count); |
| 147 | this.add(this.number); |
| 148 | } |
| 149 | |
| 150 | if (String(data.count) === this.number.text()) { |
| 151 | return; |
| 152 | } |
| 153 | |
| 154 | this.number.tween({ y: -10, opacity: 0 }, 300, 'easeInSine', () => { |
| 155 | this.number.text(data.count); |
| 156 | this.number.css({ y: 10 }).tween({ y: 0, opacity: 1 }, 1000, 'easeOutCubic'); |
| 157 | }); |
| 158 | } |
| 159 | |
| 160 | resize() { |
| 161 | const dpr = 2; // Always 2 |