Experimental AdvancedExperimentalOptions for creating the HTML source. resource is required.
Optional Experimental_GC tracking data, undefined if not being tracked
Experimentalalphathe alpha mode of the texture
ExperimentalantialiasOnly really affects RenderTextures. Should we use antialiasing for this texture. It will look better, but may impact performance as a Blit operation will be required to resolve the texture.
Experimentalarrayhow many array layers this texture has (WebGPU depthOrArrayLayers)
ExperimentalautoIf true, the Garbage Collector will unload this texture if it is not used after a period of time
ExperimentalautoShould we auto generate mipmaps for this texture? This will automatically generate mipmaps for this texture when uploading to the GPU. Mipmapped textures take up more memory, but can look better when scaled down.
For performance reasons, it is recommended to NOT use this with RenderTextures, as they are often updated every frame.
If you do, make sure to call updateMipmaps after you update the texture.
ExperimentalcanvasOwning canvas used for paint events and HTMLSource.requestPaint. Set to null
once the source is destroyed.
Readonly ExperimentaldestroyedHas the source been destroyed?
Experimentaldimensionhow many dimensions does this texture have? currently v8 only supports 2d
Experimentalformatthe format that the texture data has
Experimentalheightthe height of this texture source, accounting for resolution eg pixelHeight 200, resolution 2, then height will be 100
ExperimentalisExperimentallabeloptional label, can be used for debugging
ExperimentalmipThe number of mip levels to generate for this texture. this is overridden if autoGenerateMipmaps is true. it is read only!
Experimentalpixelthe pixel height of this texture source. This is the REAL pure number, not accounting resolution
Experimentalpixelthe pixel width of this texture source. This is the REAL pure number, not accounting resolution
Experimentalresourcethe resource that will be uploaded to the GPU. This is where we get our pixels from eg an ImageBimt / Canvas / Video etc
Readonly Experimentaluidunique id for this Texture source
ExperimentaluploadThe upload method for this texture.
Experimentalviewhow this texture is viewed/sampled by shaders (WebGPU view dimension)
Experimentalwidththe width of this texture source, accounting for resolution eg pixelWidth 200, resolution 2, then width will be 100
Static ExperimentaldefaultThe default options applied to every HTMLSource, merged with the options passed to the constructor.
Static ExperimentalextensionRegisters the source with the extensions system at the lowest texture-source priority, so automatic detection only falls back to it when no other built-in source claims the resource.
Static ExperimentalfromA helper function that creates a new TextureSource based on the resource you provide.
The resource to create the texture source from.
Experimentaltrue once the owning canvas has produced an initial paint snapshot, so the texture has
real pixels. Non-auto-updating sources are ready immediately.
ExperimentalSpecifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture.
ExperimentalExperimentalSpecifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture.
ExperimentalExperimentalSpecifies the sampling behavior when the sample footprint is smaller than or equal to one texel.
ExperimentalExperimentalSpecifies the maximum anisotropy value clamp used by the sampler.
ExperimentalSpecifies the sampling behavior when the sample footprint is larger than one texel.
Experimentalthe resolution of the texture. Changing this number, will not change the number of pixels in the actual texture but will the size of the texture when rendered.
changing the resolution of this texture to 2 for example will make it appear twice as small when rendered (as pixel density will have increased)
ExperimentalExperimentalsetting this will set magFilter,minFilter and mipmapFilter all at once!
ExperimentalExperimentalRequest a paint event from the owning canvas. Call this every frame to keep an animated
or frequently-changing element in sync with the rendered texture.
true if the request was made, false when the browser lacks the experimental
requestPaint API or there is no owning canvas.
ExperimentalResize the texture, this is handy if you want to use the texture as a render texture
Optionalwidth: numberthe new width of the texture
Optionalheight: numberthe new height of the texture
Optionalresolution: numberthe new resolution of the texture
ExperimentalThis will unload the Texture source from the GPU. This will free up the GPU memory As soon as it is required fore rendering, it will be re-uploaded.
Experimentalcall this if you have modified the texture outside of the constructor
ExperimentalLets the renderer know that this texture has been updated and its mipmaps should be re-generated. This is only important for RenderTexture instances, as standard Texture instances will have their mipmaps generated on upload. You should call this method after you make any change to the texture
The reason for this is is can be quite expensive to update mipmaps for a texture. So by default, We want you, the developer to specify when this action should happen.
Generally you don't want to have mipmaps generated on Render targets that are changed every frame,
StatictestExperimentalTests whether a resource should be handled by HTMLSource during automatic source
detection (Texture.from, TextureSource.from). Deliberately strict: only generic HTML
elements pass. Image, video, and canvas elements are rejected because they have
dedicated, faster sources; snapshots are handled by ElementImageSource.
The resource to test.
true if this source can handle the resource.
A texture source backed by the experimental HTML-in-Canvas browser APIs. It renders a live DOM Element into a texture you can use anywhere a normal texture works: on a Sprite, as a Texture frame, in a mesh, and so on.
The element keeps its native browser behavior while it is rendered: forms stay editable, links stay clickable, and CSS animations keep running. PixiJS just mirrors its pixels into the GPU each time the browser repaints it.
The source resource must be a direct child of the renderer's
<canvas layoutsubtree>element. For an immutable, transferable copy that never repaints, use ElementImageSource instead.This relies on an experimental browser proposal and requires the HTML-in-Canvas API to be enabled; without it the texture uploader throws on first render. A generic HTML element passed to
Texture.fromresolves to anHTMLSourceonly as a last resort (it has the lowest texture-source priority); construct it explicitly when you need options or non-HTML elements such as SVG.Example
Example
Example
Example
See