New Features
Actions.AddEffectBloomallows you to quickly set up a bloom effect, using several filters, on a target Camera or GameObject.Actions.AddEffectShineallows you to quickly set up a shine effect, using a new Gradient and filters, on a target Camera or GameObject.Actions.AddMaskShapeallows you to quickly add shapes to a target Camera or GameObject as Masks. Blurred edges and inversion are supported.Actions.FitToRegiontransforms an object to fit a region, such as the screen.Display.Color: several helper methods now support modifying an existingColorobject instead of creating a new one.HSLToColorHexStringToColorIntegerToColorObjectToColorRGBStringToColorValueToColor
Display.Color.Interpolate: an extra interpolation mode is available.HSVWithHSV: new method to interpolate HSV values, in HSV space.ColorWithColorhas new parameters to allow it to operate in HSV space.hsvflag sets it to operate in HSV space.hsvSignflag can force it to interpolate hue either ascending or descending. Default behavior picks the shortest angle.
Display.ColorBanddescribes a transition between two colors. Intended for use in gradients.Display.ColorRampdescribes a range of colors using ColorBands. Intended for use in gradients.GameObject#isDestroyedflag helps you avoid errors when accessing an object that might have removed expected properties during destruction.GameObjects.Gradientis a new game object which renders gradients.- Gradient shapes include:
LINEARBILINEARRADIALCONIC_SYMMETRICCONIC_ASYMMETRIC
- Gradient repeat modes include:
EXTEND: flat colors extend from start and end.TRUNCATE: transparency extends from start and end.SAWTOOTH: gradient starts over every time it completes.TRIANGULAR: gradient reverses direction every time it gets to the end or start.
- Optional Interleaved Gradient Noise based dithering to eliminate banding.
- Gradient shapes include:
GameObjects.NineSlicehas two new parameters:tileX,tileY, which allow non-corner regions of the NineSlice to tile instead of stretch. Some stretching is still applied to keep the tile count a whole number. Thanks to @skhoroshavin for this contribution!GameObjects.Noiserenders noise patterns.- Control value power curve.
- Select from trigonometric or PCG algorithms.
- Output grayscale, random color, or random normals.
- Cellular noise objects:
GameObjects.NoiseCell2D,NoiseCell3DandNoiseCell4Dprovide cellular/Worley/Voronoi noise.- Render cellular noise with sharp or smooth edges, or random flat colors.
- Smoothly animate scroll through the XY plane or evolve the pattern through Z or ZW axes.
- Add octaves of detail.
- Supports rendering as a texture or normal map for use in other effects.
- Simplex noise objects:
GameObjects.NoiseSimplex2DandNoiseSimplex3Dprovide simplex noise.- Render simplex noise, the successor to Perlin Noise.
- Use gradient flow to smoothly loop noise animation.
- Add octaves of detail.
- Apply turbulence and output shaping for a variety of effects.
- Supports rendering as a texture or normal map for use in other effects.
Tintis overhauled.tintandsetTint()now purely affect the color settings.- Previously, both would silently deactivate fill mode.
tintFillandsetTintFill()are removed.- New property
tintModeand new methodsetTintMode()now set the tint fill mode. Phaser.TintModesenumerates valid tint modes.MULTIPLYFILLADDSCREENOVERLAYHARD_LIGHT
- FILL mode now treats partial alpha correctly.
- BitmapText tinting now works correctly.
- Conversion tip:
foo.setTintFill(color)becomesfoo.setTint(color).setTintMode(Phaser.TintModes.FILL).
CombineColorMatrixfilter for remixing alpha and other channels between images.GradientMapfilter for recoloring images using a gradient and their own brightness.Keyfilter for removing or isolating colors.ImageLightfilter for image-based lighting, a soft, highly realistic form of illumination.PanoramaBlurfilter for adjusting images forImageLight.NormalToolsfilter for manipulating normal maps.Quantizefilter for reducing colors and dithering.Vignettefilter returns from Phaser 3.- Now sets a configurable border color instead of erasing alpha.
- Also supports limited blend modes.
Wipefilter returns from Phaser 3.- Now allows you to set the texture displayed in wiped-away regions.
- Now provides helper functions to set directional reveal/wipe effects.
Math.Hashprovides fast hashes of 1, 2, 3, or 4 dimensional input, using trigonometric or PCG methods.Math.HashCellprovides hashes of 1, 2, 3, or 4 dimensional input, using hash results in a Worley noise field. This produces a continuous but lumpy field.Math.HashSimplexprovides hashes of 1, 2, or 3 dimensional input, using a simplex noise implementation. This produces a continuous, smooth field.Texture#setSourcemethod for updating the source of a texture. Note that, while the source will update, derived values such as object sizes will not. It's advisable to switch between textures of identical size to avoid unexpected transforms.Texture#setDataSourcemethod already existed, but has been changed to be more useful likesetSource.TextureManager#addFlatColormethod for creating a flat texture with custom color, alpha, width, and height. This is intended to act as a temporary stand-in for textures you might not have loaded yet.TextureSource#updateSourcemethod for switching sources directly.- New
Phaser.Types.Textures.TextureSourceandPhaser.Types.Textures.TextureSourceElementtypes to simplify the increasing number of sources for a texture.
Fixes
- Fix
TimeStep#stepLimitFPSto drop fewer frames, running much more smoothly at the target frame rate. Thanks to @flow and @Antriel for discussing the topic.- Documentation in
FPSConfig#limitnow clarifies that frame limits are only necessary when artificially slowing the game below the display refresh rate.
- Documentation in
- Fix
Shapenot respecting lights even though it had the lighting component. - Fix
SpriteGPULayercreation time handling getting confused by 0. - Fix blend modes leaking onto siblings within a
Container. Thanks to @saintflow47, @tickle-monster and @leemanhopeter for reporting this. - Fix texture offsets in
ParseXMLBitmapFont. Thanks to @leemanhopeter. - Fix
DynamicTextureturning black if it initially has a power-of-two resolution and is resized to a non-power-of-two resolution. Now any WebGL texture resize will wrap with REPEAT if it is power of two, or CLAMP_TO_EDGE if not. Thanks to @x-wk for reporting this. - Fix
TextureManager.addUint8Arraymethod, which got premultiplied alpha wrong and flipY wrong.