@vpmedia/phaser 1.10.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +9 -6
- package/src/phaser/core/animation.js +9 -6
- package/src/phaser/core/animation_manager.js +14 -4
- package/src/phaser/core/animation_parser.js +24 -3
- package/src/phaser/core/array_set.js +1 -3
- package/src/phaser/core/cache.js +6 -6
- package/src/phaser/core/device.js +0 -2
- package/src/phaser/core/device_util.js +21 -6
- package/src/phaser/core/dom.js +34 -25
- package/src/phaser/core/event_manager.js +45 -17
- package/src/phaser/core/factory.js +26 -4
- package/src/phaser/core/frame.js +0 -2
- package/src/phaser/core/frame_data.js +0 -2
- package/src/phaser/core/game.js +8 -6
- package/src/phaser/core/input.js +17 -9
- package/src/phaser/core/input_handler.js +100 -26
- package/src/phaser/core/input_mouse.js +10 -14
- package/src/phaser/core/input_mspointer.js +10 -9
- package/src/phaser/core/input_pointer.js +58 -17
- package/src/phaser/core/input_touch.js +6 -8
- package/src/phaser/core/loader.js +168 -51
- package/src/phaser/core/loader_parser.js +4 -1
- package/src/phaser/core/raf.js +0 -2
- package/src/phaser/core/scale_manager.js +69 -25
- package/src/phaser/core/scene.js +0 -2
- package/src/phaser/core/scene_manager.js +6 -3
- package/src/phaser/core/signal.js +15 -8
- package/src/phaser/core/signal_binding.js +10 -5
- package/src/phaser/core/sound.js +20 -11
- package/src/phaser/core/sound_manager.js +56 -20
- package/src/phaser/core/sound_sprite.js +32 -32
- package/src/phaser/core/stage.js +0 -3
- package/src/phaser/core/time.js +0 -2
- package/src/phaser/core/timer.js +24 -7
- package/src/phaser/core/timer_event.js +0 -2
- package/src/phaser/core/tween.js +32 -8
- package/src/phaser/core/tween_data.js +15 -7
- package/src/phaser/core/tween_easing.js +24 -20
- package/src/phaser/core/tween_manager.js +31 -13
- package/src/phaser/core/world.js +0 -2
- package/src/phaser/display/bitmap_text.js +16 -10
- package/src/phaser/display/button.js +16 -4
- package/src/phaser/display/canvas/buffer.js +0 -2
- package/src/phaser/display/canvas/graphics.js +21 -9
- package/src/phaser/display/canvas/masker.js +1 -1
- package/src/phaser/display/canvas/renderer.js +39 -19
- package/src/phaser/display/canvas/tinter.js +43 -6
- package/src/phaser/display/canvas/util.js +1 -1
- package/src/phaser/display/display_object.js +33 -19
- package/src/phaser/display/graphics.js +52 -27
- package/src/phaser/display/graphics_data.js +0 -2
- package/src/phaser/display/graphics_data_util.js +9 -1
- package/src/phaser/display/group.js +1 -4
- package/src/phaser/display/image.js +2 -4
- package/src/phaser/display/sprite_batch.js +0 -2
- package/src/phaser/display/sprite_util.js +46 -11
- package/src/phaser/display/text.js +77 -26
- package/src/phaser/display/webgl/abstract_filter.js +0 -2
- package/src/phaser/display/webgl/base_texture.js +5 -3
- package/src/phaser/display/webgl/blend_manager.js +0 -2
- package/src/phaser/display/webgl/earcut.js +63 -22
- package/src/phaser/display/webgl/earcut_node.js +0 -2
- package/src/phaser/display/webgl/fast_sprite_batch.js +47 -46
- package/src/phaser/display/webgl/filter_manager.js +0 -2
- package/src/phaser/display/webgl/filter_texture.js +16 -5
- package/src/phaser/display/webgl/graphics.js +38 -16
- package/src/phaser/display/webgl/graphics_data.js +0 -2
- package/src/phaser/display/webgl/mask_manager.js +10 -2
- package/src/phaser/display/webgl/render_texture.js +14 -5
- package/src/phaser/display/webgl/renderer.js +39 -7
- package/src/phaser/display/webgl/shader/complex.js +0 -2
- package/src/phaser/display/webgl/shader/fast.js +8 -3
- package/src/phaser/display/webgl/shader/normal.js +42 -14
- package/src/phaser/display/webgl/shader/primitive.js +0 -2
- package/src/phaser/display/webgl/shader/strip.js +0 -2
- package/src/phaser/display/webgl/shader_manager.js +0 -2
- package/src/phaser/display/webgl/sprite_batch.js +13 -14
- package/src/phaser/display/webgl/stencil_manager.js +18 -20
- package/src/phaser/display/webgl/texture.js +10 -7
- package/src/phaser/display/webgl/util.js +1 -2
- package/src/phaser/geom/circle.js +15 -7
- package/src/phaser/geom/ellipse.js +13 -6
- package/src/phaser/geom/line.js +19 -10
- package/src/phaser/geom/matrix.js +0 -2
- package/src/phaser/geom/point.js +9 -11
- package/src/phaser/geom/polygon.js +9 -5
- package/src/phaser/geom/rectangle.js +44 -10
- package/src/phaser/geom/rounded_rectangle.js +0 -2
- package/src/phaser/geom/util/circle.js +3 -3
- package/src/phaser/geom/util/ellipse.js +3 -3
- package/src/phaser/geom/util/line.js +16 -13
- package/src/phaser/geom/util/point.js +1 -1
- package/src/phaser/geom/util/rectangle.js +17 -7
- package/src/phaser/util/math.js +37 -23
- package/tsconfig.json +110 -0
- package/types/index.d.ts +22 -0
- package/types/index.d.ts.map +1 -0
- package/types/phaser/core/animation.d.ts +55 -0
- package/types/phaser/core/animation.d.ts.map +1 -0
- package/types/phaser/core/animation_manager.d.ts +35 -0
- package/types/phaser/core/animation_manager.d.ts.map +1 -0
- package/types/phaser/core/animation_parser.d.ts +20 -0
- package/types/phaser/core/animation_parser.d.ts.map +1 -0
- package/types/phaser/core/array_set.d.ts +23 -0
- package/types/phaser/core/array_set.d.ts.map +1 -0
- package/types/phaser/core/cache.d.ts +106 -0
- package/types/phaser/core/cache.d.ts.map +1 -0
- package/types/phaser/core/const.d.ts +81 -0
- package/types/phaser/core/const.d.ts.map +1 -0
- package/types/phaser/core/device.d.ts +36 -0
- package/types/phaser/core/device.d.ts.map +1 -0
- package/types/phaser/core/device_util.d.ts +48 -0
- package/types/phaser/core/device_util.d.ts.map +1 -0
- package/types/phaser/core/dom.d.ts +63 -0
- package/types/phaser/core/dom.d.ts.map +1 -0
- package/types/phaser/core/event_manager.d.ts +53 -0
- package/types/phaser/core/event_manager.d.ts.map +1 -0
- package/types/phaser/core/factory.d.ts +12 -0
- package/types/phaser/core/factory.d.ts.map +1 -0
- package/types/phaser/core/frame.d.ts +30 -0
- package/types/phaser/core/frame.d.ts.map +1 -0
- package/types/phaser/core/frame_data.d.ts +14 -0
- package/types/phaser/core/frame_data.d.ts.map +1 -0
- package/types/phaser/core/frame_util.d.ts +15 -0
- package/types/phaser/core/frame_util.d.ts.map +1 -0
- package/types/phaser/core/game.d.ts +57 -0
- package/types/phaser/core/game.d.ts.map +1 -0
- package/types/phaser/core/input.d.ts +92 -0
- package/types/phaser/core/input.d.ts.map +1 -0
- package/types/phaser/core/input_handler.d.ts +111 -0
- package/types/phaser/core/input_handler.d.ts.map +1 -0
- package/types/phaser/core/input_mouse.d.ts +39 -0
- package/types/phaser/core/input_mouse.d.ts.map +1 -0
- package/types/phaser/core/input_mspointer.d.ts +34 -0
- package/types/phaser/core/input_mspointer.d.ts.map +1 -0
- package/types/phaser/core/input_pointer.d.ts +68 -0
- package/types/phaser/core/input_pointer.d.ts.map +1 -0
- package/types/phaser/core/input_touch.d.ts +37 -0
- package/types/phaser/core/input_touch.d.ts.map +1 -0
- package/types/phaser/core/loader.d.ts +94 -0
- package/types/phaser/core/loader.d.ts.map +1 -0
- package/types/phaser/core/loader_parser.d.ts +35 -0
- package/types/phaser/core/loader_parser.d.ts.map +1 -0
- package/types/phaser/core/raf.d.ts +15 -0
- package/types/phaser/core/raf.d.ts.map +1 -0
- package/types/phaser/core/scale_manager.d.ts +137 -0
- package/types/phaser/core/scale_manager.d.ts.map +1 -0
- package/types/phaser/core/scene.d.ts +17 -0
- package/types/phaser/core/scene.d.ts.map +1 -0
- package/types/phaser/core/scene_manager.d.ts +39 -0
- package/types/phaser/core/scene_manager.d.ts.map +1 -0
- package/types/phaser/core/signal.d.ts +25 -0
- package/types/phaser/core/signal.d.ts.map +1 -0
- package/types/phaser/core/signal_binding.d.ts +26 -0
- package/types/phaser/core/signal_binding.d.ts.map +1 -0
- package/types/phaser/core/sound.d.ts +72 -0
- package/types/phaser/core/sound.d.ts.map +1 -0
- package/types/phaser/core/sound_manager.d.ts +50 -0
- package/types/phaser/core/sound_manager.d.ts.map +1 -0
- package/types/phaser/core/sound_sprite.d.ts +18 -0
- package/types/phaser/core/sound_sprite.d.ts.map +1 -0
- package/types/phaser/core/stage.d.ts +23 -0
- package/types/phaser/core/stage.d.ts.map +1 -0
- package/types/phaser/core/time.d.ts +49 -0
- package/types/phaser/core/time.d.ts.map +1 -0
- package/types/phaser/core/timer.d.ts +49 -0
- package/types/phaser/core/timer.d.ts.map +1 -0
- package/types/phaser/core/timer_event.d.ts +18 -0
- package/types/phaser/core/timer_event.d.ts.map +1 -0
- package/types/phaser/core/tween.d.ts +52 -0
- package/types/phaser/core/tween.d.ts.map +1 -0
- package/types/phaser/core/tween_data.d.ts +37 -0
- package/types/phaser/core/tween_data.d.ts.map +1 -0
- package/types/phaser/core/tween_easing.d.ts +192 -0
- package/types/phaser/core/tween_easing.d.ts.map +1 -0
- package/types/phaser/core/tween_manager.d.ts +94 -0
- package/types/phaser/core/tween_manager.d.ts.map +1 -0
- package/types/phaser/core/world.d.ts +6 -0
- package/types/phaser/core/world.d.ts.map +1 -0
- package/types/phaser/display/bitmap_text.d.ts +48 -0
- package/types/phaser/display/bitmap_text.d.ts.map +1 -0
- package/types/phaser/display/button.d.ts +33 -0
- package/types/phaser/display/button.d.ts.map +1 -0
- package/types/phaser/display/canvas/buffer.d.ts +11 -0
- package/types/phaser/display/canvas/buffer.d.ts.map +1 -0
- package/types/phaser/display/canvas/graphics.d.ts +18 -0
- package/types/phaser/display/canvas/graphics.d.ts.map +1 -0
- package/types/phaser/display/canvas/masker.d.ts +12 -0
- package/types/phaser/display/canvas/masker.d.ts.map +1 -0
- package/types/phaser/display/canvas/pool.d.ts +45 -0
- package/types/phaser/display/canvas/pool.d.ts.map +1 -0
- package/types/phaser/display/canvas/renderer.d.ts +28 -0
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -0
- package/types/phaser/display/canvas/tinter.d.ts +36 -0
- package/types/phaser/display/canvas/tinter.d.ts.map +1 -0
- package/types/phaser/display/canvas/util.d.ts +70 -0
- package/types/phaser/display/canvas/util.d.ts.map +1 -0
- package/types/phaser/display/display_object.d.ts +83 -0
- package/types/phaser/display/display_object.d.ts.map +1 -0
- package/types/phaser/display/graphics.d.ts +53 -0
- package/types/phaser/display/graphics.d.ts.map +1 -0
- package/types/phaser/display/graphics_data.d.ts +15 -0
- package/types/phaser/display/graphics_data.d.ts.map +1 -0
- package/types/phaser/display/graphics_data_util.d.ts +7 -0
- package/types/phaser/display/graphics_data_util.d.ts.map +1 -0
- package/types/phaser/display/group.d.ts +41 -0
- package/types/phaser/display/group.d.ts.map +1 -0
- package/types/phaser/display/image.d.ts +43 -0
- package/types/phaser/display/image.d.ts.map +1 -0
- package/types/phaser/display/sprite_batch.d.ts +6 -0
- package/types/phaser/display/sprite_batch.d.ts.map +1 -0
- package/types/phaser/display/sprite_util.d.ts +35 -0
- package/types/phaser/display/sprite_util.d.ts.map +1 -0
- package/types/phaser/display/text.d.ts +116 -0
- package/types/phaser/display/text.d.ts.map +1 -0
- package/types/phaser/display/webgl/abstract_filter.d.ts +17 -0
- package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -0
- package/types/phaser/display/webgl/base_texture.d.ts +20 -0
- package/types/phaser/display/webgl/base_texture.d.ts.map +1 -0
- package/types/phaser/display/webgl/blend_manager.d.ts +14 -0
- package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -0
- package/types/phaser/display/webgl/earcut.d.ts +215 -0
- package/types/phaser/display/webgl/earcut.d.ts.map +1 -0
- package/types/phaser/display/webgl/earcut_node.d.ts +19 -0
- package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -0
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +34 -0
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -0
- package/types/phaser/display/webgl/filter_manager.d.ts +21 -0
- package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -0
- package/types/phaser/display/webgl/filter_texture.d.ts +13 -0
- package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -0
- package/types/phaser/display/webgl/graphics.d.ts +80 -0
- package/types/phaser/display/webgl/graphics.d.ts.map +1 -0
- package/types/phaser/display/webgl/graphics_data.d.ts +23 -0
- package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -0
- package/types/phaser/display/webgl/mask_manager.d.ts +13 -0
- package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -0
- package/types/phaser/display/webgl/render_texture.d.ts +25 -0
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -0
- package/types/phaser/display/webgl/renderer.d.ts +44 -0
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -0
- package/types/phaser/display/webgl/shader/complex.d.ts +22 -0
- package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -0
- package/types/phaser/display/webgl/shader/fast.d.ts +25 -0
- package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -0
- package/types/phaser/display/webgl/shader/normal.d.ts +25 -0
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -0
- package/types/phaser/display/webgl/shader/primitive.d.ts +21 -0
- package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -0
- package/types/phaser/display/webgl/shader/strip.d.ts +22 -0
- package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -0
- package/types/phaser/display/webgl/shader_manager.d.ts +24 -0
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -0
- package/types/phaser/display/webgl/sprite_batch.d.ts +36 -0
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -0
- package/types/phaser/display/webgl/stencil_manager.d.ts +12 -0
- package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -0
- package/types/phaser/display/webgl/texture.d.ts +30 -0
- package/types/phaser/display/webgl/texture.d.ts.map +1 -0
- package/types/phaser/display/webgl/texture_util.d.ts +15 -0
- package/types/phaser/display/webgl/texture_util.d.ts.map +1 -0
- package/types/phaser/display/webgl/util.d.ts +41 -0
- package/types/phaser/display/webgl/util.d.ts.map +1 -0
- package/types/phaser/geom/circle.d.ts +39 -0
- package/types/phaser/geom/circle.d.ts.map +1 -0
- package/types/phaser/geom/ellipse.d.ts +18 -0
- package/types/phaser/geom/ellipse.d.ts.map +1 -0
- package/types/phaser/geom/line.d.ts +37 -0
- package/types/phaser/geom/line.d.ts.map +1 -0
- package/types/phaser/geom/matrix.d.ts +25 -0
- package/types/phaser/geom/matrix.d.ts.map +1 -0
- package/types/phaser/geom/point.d.ts +37 -0
- package/types/phaser/geom/point.d.ts.map +1 -0
- package/types/phaser/geom/polygon.d.ts +17 -0
- package/types/phaser/geom/polygon.d.ts.map +1 -0
- package/types/phaser/geom/rectangle.d.ts +63 -0
- package/types/phaser/geom/rectangle.d.ts.map +1 -0
- package/types/phaser/geom/rounded_rectangle.d.ts +12 -0
- package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -0
- package/types/phaser/geom/util/circle.d.ts +55 -0
- package/types/phaser/geom/util/circle.d.ts.map +1 -0
- package/types/phaser/geom/util/ellipse.d.ts +21 -0
- package/types/phaser/geom/util/ellipse.d.ts.map +1 -0
- package/types/phaser/geom/util/line.d.ts +42 -0
- package/types/phaser/geom/util/line.d.ts.map +1 -0
- package/types/phaser/geom/util/matrix.d.ts +20 -0
- package/types/phaser/geom/util/matrix.d.ts.map +1 -0
- package/types/phaser/geom/util/point.d.ts +157 -0
- package/types/phaser/geom/util/point.d.ts.map +1 -0
- package/types/phaser/geom/util/polygon.d.ts +15 -0
- package/types/phaser/geom/util/polygon.d.ts.map +1 -0
- package/types/phaser/geom/util/rectangle.d.ts +124 -0
- package/types/phaser/geom/util/rectangle.d.ts.map +1 -0
- package/types/phaser/geom/util/rounded_rectangle.d.ts +15 -0
- package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -0
- package/types/phaser/util/math.d.ts +162 -0
- package/types/phaser/util/math.d.ts.map +1 -0
|
@@ -84,7 +84,7 @@ export function QuarticIn(k) {
|
|
|
84
84
|
* @returns {number} TBD
|
|
85
85
|
*/
|
|
86
86
|
export function QuarticOut(k) {
|
|
87
|
-
return 1 -
|
|
87
|
+
return 1 - --k * k * k * k;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
/**
|
|
@@ -133,7 +133,7 @@ export function QuinticInOut(k) {
|
|
|
133
133
|
export function SinusoidalIn(k) {
|
|
134
134
|
if (k === 0) return 0;
|
|
135
135
|
if (k === 1) return 1;
|
|
136
|
-
return 1 - Math.cos(k * Math.PI / 2);
|
|
136
|
+
return 1 - Math.cos((k * Math.PI) / 2);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
/**
|
|
@@ -144,7 +144,7 @@ export function SinusoidalIn(k) {
|
|
|
144
144
|
export function SinusoidalOut(k) {
|
|
145
145
|
if (k === 0) return 0;
|
|
146
146
|
if (k === 1) return 1;
|
|
147
|
-
return Math.sin(k * Math.PI / 2);
|
|
147
|
+
return Math.sin((k * Math.PI) / 2);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
/**
|
|
@@ -203,7 +203,7 @@ export function CircularIn(k) {
|
|
|
203
203
|
* @returns {number} TBD
|
|
204
204
|
*/
|
|
205
205
|
export function CircularOut(k) {
|
|
206
|
-
return Math.sqrt(1 -
|
|
206
|
+
return Math.sqrt(1 - --k * k);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
/**
|
|
@@ -228,11 +228,12 @@ export function ElasticIn(k) {
|
|
|
228
228
|
if (k === 0) return 0;
|
|
229
229
|
if (k === 1) return 1;
|
|
230
230
|
if (!a || a < 1) {
|
|
231
|
-
a = 1;
|
|
231
|
+
a = 1;
|
|
232
|
+
s = p / 4;
|
|
232
233
|
} else {
|
|
233
|
-
s = p * Math.asin(1 / a) / (2 * Math.PI);
|
|
234
|
+
s = (p * Math.asin(1 / a)) / (2 * Math.PI);
|
|
234
235
|
}
|
|
235
|
-
return -(a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p));
|
|
236
|
+
return -(a * Math.pow(2, 10 * (k -= 1)) * Math.sin(((k - s) * (2 * Math.PI)) / p));
|
|
236
237
|
}
|
|
237
238
|
|
|
238
239
|
/**
|
|
@@ -247,11 +248,12 @@ export function ElasticOut(k) {
|
|
|
247
248
|
if (k === 0) return 0;
|
|
248
249
|
if (k === 1) return 1;
|
|
249
250
|
if (!a || a < 1) {
|
|
250
|
-
a = 1;
|
|
251
|
+
a = 1;
|
|
252
|
+
s = p / 4;
|
|
251
253
|
} else {
|
|
252
|
-
s = p * Math.asin(1 / a) / (2 * Math.PI);
|
|
254
|
+
s = (p * Math.asin(1 / a)) / (2 * Math.PI);
|
|
253
255
|
}
|
|
254
|
-
return
|
|
256
|
+
return a * Math.pow(2, -10 * k) * Math.sin(((k - s) * (2 * Math.PI)) / p) + 1;
|
|
255
257
|
}
|
|
256
258
|
|
|
257
259
|
/**
|
|
@@ -266,12 +268,14 @@ export function ElasticInOut(k) {
|
|
|
266
268
|
if (k === 0) return 0;
|
|
267
269
|
if (k === 1) return 1;
|
|
268
270
|
if (!a || a < 1) {
|
|
269
|
-
a = 1;
|
|
271
|
+
a = 1;
|
|
272
|
+
s = p / 4;
|
|
270
273
|
} else {
|
|
271
|
-
s = p * Math.asin(1 / a) / (2 * Math.PI);
|
|
274
|
+
s = (p * Math.asin(1 / a)) / (2 * Math.PI);
|
|
272
275
|
}
|
|
273
|
-
if ((k *= 2) < 1)
|
|
274
|
-
|
|
276
|
+
if ((k *= 2) < 1)
|
|
277
|
+
return -0.5 * (a * Math.pow(2, 10 * (k -= 1)) * Math.sin(((k - s) * (2 * Math.PI)) / p));
|
|
278
|
+
return a * Math.pow(2, -10 * (k -= 1)) * Math.sin(((k - s) * (2 * Math.PI)) / p) * 0.5 + 1;
|
|
275
279
|
}
|
|
276
280
|
|
|
277
281
|
/**
|
|
@@ -311,14 +315,14 @@ export function BackInOut(k) {
|
|
|
311
315
|
* @returns {number} TBD
|
|
312
316
|
*/
|
|
313
317
|
export function BounceOut(k) {
|
|
314
|
-
if (k <
|
|
318
|
+
if (k < 1 / 2.75) {
|
|
315
319
|
return 7.5625 * k * k;
|
|
316
|
-
} else if (k <
|
|
317
|
-
return 7.5625 * (k -=
|
|
318
|
-
} else if (k <
|
|
319
|
-
return 7.5625 * (k -=
|
|
320
|
+
} else if (k < 2 / 2.75) {
|
|
321
|
+
return 7.5625 * (k -= 1.5 / 2.75) * k + 0.75;
|
|
322
|
+
} else if (k < 2.5 / 2.75) {
|
|
323
|
+
return 7.5625 * (k -= 2.25 / 2.75) * k + 0.9375;
|
|
320
324
|
}
|
|
321
|
-
return 7.5625 * (k -=
|
|
325
|
+
return 7.5625 * (k -= 2.625 / 2.75) * k + 0.984375;
|
|
322
326
|
}
|
|
323
327
|
|
|
324
328
|
/**
|
|
@@ -6,21 +6,40 @@
|
|
|
6
6
|
import Tween from './tween';
|
|
7
7
|
import {
|
|
8
8
|
LinearNone,
|
|
9
|
-
QuadraticIn,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
QuadraticIn,
|
|
10
|
+
QuadraticOut,
|
|
11
|
+
QuadraticInOut,
|
|
12
|
+
CubicIn,
|
|
13
|
+
CubicOut,
|
|
14
|
+
CubicInOut,
|
|
15
|
+
QuarticIn,
|
|
16
|
+
QuarticOut,
|
|
17
|
+
QuarticInOut,
|
|
18
|
+
QuinticIn,
|
|
19
|
+
QuinticOut,
|
|
20
|
+
QuinticInOut,
|
|
21
|
+
SinusoidalIn,
|
|
22
|
+
SinusoidalOut,
|
|
23
|
+
SinusoidalInOut,
|
|
24
|
+
ExponentialIn,
|
|
25
|
+
ExponentialOut,
|
|
26
|
+
ExponentialInOut,
|
|
27
|
+
CircularIn,
|
|
28
|
+
CircularOut,
|
|
29
|
+
CircularInOut,
|
|
30
|
+
ElasticIn,
|
|
31
|
+
ElasticOut,
|
|
32
|
+
ElasticInOut,
|
|
33
|
+
BackIn,
|
|
34
|
+
BackOut,
|
|
35
|
+
BackInOut,
|
|
36
|
+
BounceIn,
|
|
37
|
+
BounceOut,
|
|
38
|
+
BounceInOut,
|
|
19
39
|
} from './tween_easing';
|
|
20
40
|
import { GROUP } from './const';
|
|
21
41
|
|
|
22
42
|
export default class {
|
|
23
|
-
|
|
24
43
|
constructor(game) {
|
|
25
44
|
this.game = game;
|
|
26
45
|
this._tweens = [];
|
|
@@ -154,7 +173,7 @@ export default class {
|
|
|
154
173
|
}
|
|
155
174
|
|
|
156
175
|
isTweening(object) {
|
|
157
|
-
return this._tweens.some(tween => tween.target === object);
|
|
176
|
+
return this._tweens.some((tween) => tween.target === object);
|
|
158
177
|
}
|
|
159
178
|
|
|
160
179
|
_pauseAll() {
|
|
@@ -180,5 +199,4 @@ export default class {
|
|
|
180
199
|
this._tweens[i].resume(true);
|
|
181
200
|
}
|
|
182
201
|
}
|
|
183
|
-
|
|
184
202
|
}
|
package/src/phaser/core/world.js
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import Group from '../display/group';
|
|
7
7
|
|
|
8
8
|
export default class extends Group {
|
|
9
|
-
|
|
10
9
|
constructor(game) {
|
|
11
10
|
super(game, null, '__world', false);
|
|
12
11
|
}
|
|
@@ -14,5 +13,4 @@ export default class extends Group {
|
|
|
14
13
|
boot() {
|
|
15
14
|
this.game.stage.addChild(this);
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
}
|
|
@@ -9,7 +9,6 @@ import Point from '../geom/point';
|
|
|
9
9
|
import { BITMAP_TEXT, SCALE_LINEAR, SCALE_NEAREST } from '../core/const';
|
|
10
10
|
|
|
11
11
|
export default class extends DisplayObject {
|
|
12
|
-
|
|
13
12
|
constructor(game, x = 0, y = 0, font = '', text = '', size = 32, align = 'left') {
|
|
14
13
|
super();
|
|
15
14
|
this.game = game;
|
|
@@ -25,7 +24,7 @@ export default class extends DisplayObject {
|
|
|
25
24
|
this._font = font;
|
|
26
25
|
this._fontSize = size;
|
|
27
26
|
this._align = align;
|
|
28
|
-
this._tint =
|
|
27
|
+
this._tint = 0xffffff;
|
|
29
28
|
this.updateText();
|
|
30
29
|
this.dirty = false;
|
|
31
30
|
}
|
|
@@ -67,7 +66,7 @@ export default class extends DisplayObject {
|
|
|
67
66
|
let lastSpace = -1;
|
|
68
67
|
let wrappedWidth = 0;
|
|
69
68
|
let prevCharCode = null;
|
|
70
|
-
const maxWidth =
|
|
69
|
+
const maxWidth = this._maxWidth > 0 ? this._maxWidth : null;
|
|
71
70
|
const chars = [];
|
|
72
71
|
// Let's scan the text and work out if any of the lines are > maxWidth
|
|
73
72
|
let end = true;
|
|
@@ -91,7 +90,8 @@ export default class extends DisplayObject {
|
|
|
91
90
|
charData = data.chars[charCode];
|
|
92
91
|
}
|
|
93
92
|
// Adjust for kerning from previous character to this one
|
|
94
|
-
const kerning =
|
|
93
|
+
const kerning =
|
|
94
|
+
prevCharCode && charData.kerning[prevCharCode] ? charData.kerning[prevCharCode] : 0;
|
|
95
95
|
// Record the last space in the string and the current width
|
|
96
96
|
if (/(\s)/.test(text.charAt(i))) {
|
|
97
97
|
lastSpace = i;
|
|
@@ -100,7 +100,7 @@ export default class extends DisplayObject {
|
|
|
100
100
|
// What will the line width be if we add this character to it?
|
|
101
101
|
c = (kerning + charData.texture.width + charData.xOffset) * scale;
|
|
102
102
|
// Do we need to line-wrap?
|
|
103
|
-
if (maxWidth &&
|
|
103
|
+
if (maxWidth && w + c >= maxWidth && lastSpace > -1) {
|
|
104
104
|
// The last space was at "lastSpace" which was "i - lastSpace" characters ago
|
|
105
105
|
return {
|
|
106
106
|
width: wrappedWidth || w,
|
|
@@ -162,7 +162,7 @@ export default class extends DisplayObject {
|
|
|
162
162
|
if (line.width > this.textWidth) {
|
|
163
163
|
this.textWidth = line.width;
|
|
164
164
|
}
|
|
165
|
-
y +=
|
|
165
|
+
y += data.lineHeight * scale;
|
|
166
166
|
text = text.substr(line.text.length + 1);
|
|
167
167
|
} while (line.end === false);
|
|
168
168
|
this.textHeight = y;
|
|
@@ -194,8 +194,8 @@ export default class extends DisplayObject {
|
|
|
194
194
|
g.name = currentLine.text[c];
|
|
195
195
|
this._glyphs.push(g);
|
|
196
196
|
}
|
|
197
|
-
g.position.x =
|
|
198
|
-
g.position.y =
|
|
197
|
+
g.position.x = currentLine.chars[c] + align - ax;
|
|
198
|
+
g.position.y = currentLine.y + charData.yOffset * scale - ay;
|
|
199
199
|
g.scale.set(scale);
|
|
200
200
|
g.tint = this.tint;
|
|
201
201
|
g.texture.requiresReTint = true;
|
|
@@ -260,7 +260,14 @@ export default class extends DisplayObject {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
get fill() {
|
|
263
|
-
|
|
263
|
+
if (typeof this.tint === 'number') {
|
|
264
|
+
let colorStr = this.tint.toString(16);
|
|
265
|
+
while (colorStr.length < 6) {
|
|
266
|
+
colorStr = '0' + colorStr;
|
|
267
|
+
}
|
|
268
|
+
return `#${colorStr.toUpperCase()}`;
|
|
269
|
+
}
|
|
270
|
+
return this.tint;
|
|
264
271
|
}
|
|
265
272
|
|
|
266
273
|
set fill(value) {
|
|
@@ -326,5 +333,4 @@ export default class extends DisplayObject {
|
|
|
326
333
|
this._data.base.scaleMode = SCALE_NEAREST;
|
|
327
334
|
}
|
|
328
335
|
}
|
|
329
|
-
|
|
330
336
|
}
|
|
@@ -15,8 +15,18 @@ const STATE_UP = 'Up';
|
|
|
15
15
|
const STATE_DISABLED = 'Disabled';
|
|
16
16
|
|
|
17
17
|
export default class extends Image {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
constructor(
|
|
19
|
+
game,
|
|
20
|
+
x = 0,
|
|
21
|
+
y = 0,
|
|
22
|
+
key = null,
|
|
23
|
+
callback = null,
|
|
24
|
+
callbackContext = null,
|
|
25
|
+
overFrame = null,
|
|
26
|
+
outFrame = null,
|
|
27
|
+
downFrame = null,
|
|
28
|
+
upFrame = null
|
|
29
|
+
) {
|
|
20
30
|
super(game, x, y, key, outFrame);
|
|
21
31
|
this.type = BUTTON;
|
|
22
32
|
this._onOverFrame = null;
|
|
@@ -125,7 +135,10 @@ export default class extends Image {
|
|
|
125
135
|
}
|
|
126
136
|
|
|
127
137
|
onInputOverHandler(sprite, pointer) {
|
|
128
|
-
if (
|
|
138
|
+
if (
|
|
139
|
+
pointer.justReleased() &&
|
|
140
|
+
(this.justReleasedPreventsOver & pointer.pointerMode) === pointer.pointerMode
|
|
141
|
+
) {
|
|
129
142
|
// If the Pointer was only just released then we don't fire an over event
|
|
130
143
|
return;
|
|
131
144
|
}
|
|
@@ -190,5 +203,4 @@ export default class extends Image {
|
|
|
190
203
|
this.input.stop();
|
|
191
204
|
}
|
|
192
205
|
}
|
|
193
|
-
|
|
194
206
|
}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
import { create, removeByCanvas } from './pool';
|
|
8
8
|
|
|
9
9
|
export default class {
|
|
10
|
-
|
|
11
10
|
constructor(width, height) {
|
|
12
11
|
this.width = width;
|
|
13
12
|
this.height = height;
|
|
@@ -32,5 +31,4 @@ export default class {
|
|
|
32
31
|
destroy() {
|
|
33
32
|
removeByCanvas(this.canvas);
|
|
34
33
|
}
|
|
35
|
-
|
|
36
34
|
}
|
|
@@ -4,25 +4,37 @@
|
|
|
4
4
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
5
|
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
GEOM_POLYGON,
|
|
9
|
+
GEOM_RECTANGLE,
|
|
10
|
+
GEOM_CIRCLE,
|
|
11
|
+
GEOM_ELLIPSE,
|
|
12
|
+
GEOM_ROUNDED_RECTANGLE,
|
|
13
|
+
} from '../../core/const';
|
|
8
14
|
|
|
9
15
|
/**
|
|
10
16
|
*
|
|
11
17
|
* @param {object} graphics TBD
|
|
12
18
|
*/
|
|
13
19
|
export function updateGraphicsTint(graphics) {
|
|
14
|
-
if (graphics.tint ===
|
|
20
|
+
if (graphics.tint === 0xffffff) {
|
|
15
21
|
return;
|
|
16
22
|
}
|
|
17
|
-
const tintR = (graphics.tint >> 16 &
|
|
18
|
-
const tintG = (graphics.tint >> 8 &
|
|
19
|
-
const tintB = (graphics.tint &
|
|
23
|
+
const tintR = ((graphics.tint >> 16) & 0xff) / 255;
|
|
24
|
+
const tintG = ((graphics.tint >> 8) & 0xff) / 255;
|
|
25
|
+
const tintB = (graphics.tint & 0xff) / 255;
|
|
20
26
|
for (let i = 0; i < graphics.graphicsData.length; i += 1) {
|
|
21
27
|
const data = graphics.graphicsData[i];
|
|
22
28
|
const fillColor = data.fillColor | 0;
|
|
23
29
|
const lineColor = data.lineColor | 0;
|
|
24
|
-
data._fillTint =
|
|
25
|
-
|
|
30
|
+
data._fillTint =
|
|
31
|
+
(((((fillColor >> 16) & 0xff) / 255) * tintR * 255) << 16) +
|
|
32
|
+
(((((fillColor >> 8) & 0xff) / 255) * tintG * 255) << 8) +
|
|
33
|
+
((fillColor & 0xff) / 255) * tintB * 255;
|
|
34
|
+
data._lineTint =
|
|
35
|
+
(((((lineColor >> 16) & 0xff) / 255) * tintR * 255) << 16) +
|
|
36
|
+
(((((lineColor >> 8) & 0xff) / 255) * tintG * 255) << 8) +
|
|
37
|
+
((lineColor & 0xff) / 255) * tintB * 255;
|
|
26
38
|
}
|
|
27
39
|
}
|
|
28
40
|
|
|
@@ -128,7 +140,7 @@ export function renderGraphics(graphics, context) {
|
|
|
128
140
|
const width = shape.width;
|
|
129
141
|
const height = shape.height;
|
|
130
142
|
let radius = shape.radius;
|
|
131
|
-
const maxRadius = Math.min(width, height) / 2 | 0;
|
|
143
|
+
const maxRadius = (Math.min(width, height) / 2) | 0;
|
|
132
144
|
radius = radius > maxRadius ? maxRadius : radius;
|
|
133
145
|
context.beginPath();
|
|
134
146
|
context.moveTo(rx, ry + radius);
|
|
@@ -210,7 +222,7 @@ export function renderGraphicsMask(graphics, context) {
|
|
|
210
222
|
const width = shape.width;
|
|
211
223
|
const height = shape.height;
|
|
212
224
|
let radius = shape.radius;
|
|
213
|
-
const maxRadius = Math.min(width, height) / 2 | 0;
|
|
225
|
+
const maxRadius = (Math.min(width, height) / 2) | 0;
|
|
214
226
|
radius = radius > maxRadius ? maxRadius : radius;
|
|
215
227
|
context.moveTo(rx, ry + radius);
|
|
216
228
|
context.lineTo(rx, ry + height - radius);
|
|
@@ -23,7 +23,7 @@ export function pushMask(maskData, renderSession) {
|
|
|
23
23
|
transform.c * resolution,
|
|
24
24
|
transform.d * resolution,
|
|
25
25
|
transform.tx * resolution,
|
|
26
|
-
transform.ty * resolution
|
|
26
|
+
transform.ty * resolution
|
|
27
27
|
);
|
|
28
28
|
renderGraphicsMask(maskData, context);
|
|
29
29
|
context.clip();
|
|
@@ -4,13 +4,33 @@
|
|
|
4
4
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
5
|
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
RENDER_CANVAS,
|
|
9
|
+
SCALE_LINEAR,
|
|
10
|
+
BLEND_NORMAL,
|
|
11
|
+
BLEND_ADD,
|
|
12
|
+
BLEND_MULTIPLY,
|
|
13
|
+
BLEND_SCREEN,
|
|
14
|
+
BLEND_OVERLAY,
|
|
15
|
+
BLEND_DARKEN,
|
|
16
|
+
BLEND_LIGHTEN,
|
|
17
|
+
BLEND_COLOR_DODGE,
|
|
18
|
+
BLEND_COLOR_BURN,
|
|
19
|
+
BLEND_HARD_LIGHT,
|
|
20
|
+
BLEND_SOFT_LIGHT,
|
|
21
|
+
BLEND_DIFFERENCE,
|
|
22
|
+
BLEND_EXCLUSION,
|
|
23
|
+
BLEND_HUE,
|
|
24
|
+
BLEND_SATURATION,
|
|
25
|
+
BLEND_COLOR,
|
|
26
|
+
BLEND_LUMINOSITY,
|
|
27
|
+
SCALE_NEAREST,
|
|
28
|
+
} from '../../core/const';
|
|
8
29
|
import { getSmoothingPrefix } from './util';
|
|
9
30
|
import { detectCapabilities } from './tinter';
|
|
10
31
|
import * as CanvasMaskManager from './masker';
|
|
11
32
|
|
|
12
33
|
export default class {
|
|
13
|
-
|
|
14
34
|
constructor(game) {
|
|
15
35
|
detectCapabilities();
|
|
16
36
|
this.type = RENDER_CANVAS;
|
|
@@ -78,7 +98,8 @@ export default class {
|
|
|
78
98
|
this.view.style.height = this.height / this.resolution + 'px';
|
|
79
99
|
}
|
|
80
100
|
if (this.renderSession.smoothProperty) {
|
|
81
|
-
this.context[this.renderSession.smoothProperty] =
|
|
101
|
+
this.context[this.renderSession.smoothProperty] =
|
|
102
|
+
this.renderSession.scaleMode === SCALE_LINEAR;
|
|
82
103
|
}
|
|
83
104
|
}
|
|
84
105
|
|
|
@@ -96,22 +117,21 @@ export default class {
|
|
|
96
117
|
const useNew = window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY;
|
|
97
118
|
b[BLEND_NORMAL] = 'source-over';
|
|
98
119
|
b[BLEND_ADD] = 'lighter';
|
|
99
|
-
b[BLEND_MULTIPLY] =
|
|
100
|
-
b[BLEND_SCREEN] =
|
|
101
|
-
b[BLEND_OVERLAY] =
|
|
102
|
-
b[BLEND_DARKEN] =
|
|
103
|
-
b[BLEND_LIGHTEN] =
|
|
104
|
-
b[BLEND_COLOR_DODGE] =
|
|
105
|
-
b[BLEND_COLOR_BURN] =
|
|
106
|
-
b[BLEND_HARD_LIGHT] =
|
|
107
|
-
b[BLEND_SOFT_LIGHT] =
|
|
108
|
-
b[BLEND_DIFFERENCE] =
|
|
109
|
-
b[BLEND_EXCLUSION] =
|
|
110
|
-
b[BLEND_HUE] =
|
|
111
|
-
b[BLEND_SATURATION] =
|
|
112
|
-
b[BLEND_COLOR] =
|
|
113
|
-
b[BLEND_LUMINOSITY] =
|
|
120
|
+
b[BLEND_MULTIPLY] = useNew ? 'multiply' : 'source-over';
|
|
121
|
+
b[BLEND_SCREEN] = useNew ? 'screen' : 'source-over';
|
|
122
|
+
b[BLEND_OVERLAY] = useNew ? 'overlay' : 'source-over';
|
|
123
|
+
b[BLEND_DARKEN] = useNew ? 'darken' : 'source-over';
|
|
124
|
+
b[BLEND_LIGHTEN] = useNew ? 'lighten' : 'source-over';
|
|
125
|
+
b[BLEND_COLOR_DODGE] = useNew ? 'color-dodge' : 'source-over';
|
|
126
|
+
b[BLEND_COLOR_BURN] = useNew ? 'color-burn' : 'source-over';
|
|
127
|
+
b[BLEND_HARD_LIGHT] = useNew ? 'hard-light' : 'source-over';
|
|
128
|
+
b[BLEND_SOFT_LIGHT] = useNew ? 'soft-light' : 'source-over';
|
|
129
|
+
b[BLEND_DIFFERENCE] = useNew ? 'difference' : 'source-over';
|
|
130
|
+
b[BLEND_EXCLUSION] = useNew ? 'exclusion' : 'source-over';
|
|
131
|
+
b[BLEND_HUE] = useNew ? 'hue' : 'source-over';
|
|
132
|
+
b[BLEND_SATURATION] = useNew ? 'saturation' : 'source-over';
|
|
133
|
+
b[BLEND_COLOR] = useNew ? 'color' : 'source-over';
|
|
134
|
+
b[BLEND_LUMINOSITY] = useNew ? 'luminosity' : 'source-over';
|
|
114
135
|
window.PhaserRegistry.blendModesCanvas = b;
|
|
115
136
|
}
|
|
116
|
-
|
|
117
137
|
}
|
|
@@ -37,9 +37,29 @@ export function tintWithMultiply(texture, color, canvas) {
|
|
|
37
37
|
context.fillStyle = '#' + ('00000' + (color | 0).toString(16)).substr(-6);
|
|
38
38
|
context.fillRect(0, 0, crop.width, crop.height);
|
|
39
39
|
context.globalCompositeOperation = 'multiply';
|
|
40
|
-
context.drawImage(
|
|
40
|
+
context.drawImage(
|
|
41
|
+
texture.baseTexture.source,
|
|
42
|
+
crop.x,
|
|
43
|
+
crop.y,
|
|
44
|
+
crop.width,
|
|
45
|
+
crop.height,
|
|
46
|
+
0,
|
|
47
|
+
0,
|
|
48
|
+
crop.width,
|
|
49
|
+
crop.height
|
|
50
|
+
);
|
|
41
51
|
context.globalCompositeOperation = 'destination-atop';
|
|
42
|
-
context.drawImage(
|
|
52
|
+
context.drawImage(
|
|
53
|
+
texture.baseTexture.source,
|
|
54
|
+
crop.x,
|
|
55
|
+
crop.y,
|
|
56
|
+
crop.width,
|
|
57
|
+
crop.height,
|
|
58
|
+
0,
|
|
59
|
+
0,
|
|
60
|
+
crop.width,
|
|
61
|
+
crop.height
|
|
62
|
+
);
|
|
43
63
|
}
|
|
44
64
|
|
|
45
65
|
/**
|
|
@@ -54,7 +74,17 @@ export function tintWithPerPixel(texture, color, canvas) {
|
|
|
54
74
|
canvas.width = crop.width;
|
|
55
75
|
canvas.height = crop.height;
|
|
56
76
|
context.globalCompositeOperation = 'copy';
|
|
57
|
-
context.drawImage(
|
|
77
|
+
context.drawImage(
|
|
78
|
+
texture.baseTexture.source,
|
|
79
|
+
crop.x,
|
|
80
|
+
crop.y,
|
|
81
|
+
crop.width,
|
|
82
|
+
crop.height,
|
|
83
|
+
0,
|
|
84
|
+
0,
|
|
85
|
+
crop.width,
|
|
86
|
+
crop.height
|
|
87
|
+
);
|
|
58
88
|
const rgbValues = hex2rgb(color);
|
|
59
89
|
const r = rgbValues[0];
|
|
60
90
|
const g = rgbValues[1];
|
|
@@ -95,7 +125,12 @@ export function checkInverseAlpha() {
|
|
|
95
125
|
// Get those values
|
|
96
126
|
const s2 = canvas.context.getImageData(1, 0, 1, 1);
|
|
97
127
|
// Compare and return
|
|
98
|
-
return (
|
|
128
|
+
return (
|
|
129
|
+
s2.data[0] === s1.data[0] &&
|
|
130
|
+
s2.data[1] === s1.data[1] &&
|
|
131
|
+
s2.data[2] === s1.data[2] &&
|
|
132
|
+
s2.data[3] === s1.data[3]
|
|
133
|
+
);
|
|
99
134
|
}
|
|
100
135
|
|
|
101
136
|
/**
|
|
@@ -122,7 +157,7 @@ export function canUseNewCanvasBlendModes() {
|
|
|
122
157
|
}
|
|
123
158
|
const data = context.getImageData(2, 0, 1, 1).data;
|
|
124
159
|
removeByCanvas(canvas);
|
|
125
|
-
return
|
|
160
|
+
return data[0] === 255 && data[1] === 0 && data[2] === 0;
|
|
126
161
|
}
|
|
127
162
|
|
|
128
163
|
/**
|
|
@@ -139,6 +174,8 @@ export function detectCapabilities() {
|
|
|
139
174
|
window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY = canUseNewCanvasBlendModes();
|
|
140
175
|
}
|
|
141
176
|
if (!window.PhaserRegistry.CANVAS_TINT_METHOD) {
|
|
142
|
-
window.PhaserRegistry.CANVAS_TINT_METHOD = window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY
|
|
177
|
+
window.PhaserRegistry.CANVAS_TINT_METHOD = window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY
|
|
178
|
+
? tintWithMultiply
|
|
179
|
+
: tintWithPerPixel;
|
|
143
180
|
}
|
|
144
181
|
}
|
|
@@ -18,7 +18,7 @@ import { create as createCanvas } from './pool';
|
|
|
18
18
|
export function create(parent, width, height, id, skipPool) {
|
|
19
19
|
width = width || 256;
|
|
20
20
|
height = height || 256;
|
|
21
|
-
const canvas =
|
|
21
|
+
const canvas = skipPool ? document.createElement('canvas') : createCanvas(parent, width, height);
|
|
22
22
|
if (typeof id === 'string' && id !== '') {
|
|
23
23
|
canvas.id = id;
|
|
24
24
|
}
|