Remove Code Remove Sprite Remove Texture
article thumbnail

Tutorial: Cocos Shader Series - Use a Noise Map to Make a Dissolve Texture

Cocos

Blockquote const sprite = this.getComponent(Sprite); const mat = sprite.customMaterial; mat.setProperty(‘dissolveThreshold’, 0.5); Version 3.6.x, x, I using this code but it not bring Property affect to shader Ok, this work if turn of Packable in main Sprite inspector

Shaders 98
article thumbnail

Cocos creator (2.4.13) Effect Material is not centered at the Sprite Node

Cocos

height)); I am considered myself as a beginner of GLSL shader coding and would be appreciated if anyone would explain to me and show me how to fix this. The goal is to make my effect able to follow the position of my node. 5 + ((gl_FragCoord.xy)/ iResolution.xy); p.x *= iResolution.x / iResolution.y; intensity); } }% // In typescript this.

Sprite 52
Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Trending Sources

article thumbnail

Can't set texture for spriteframe

Cocos

i wrote a little code to load asset texture from resource. i wrote a little code to load asset texture from resource. 0 ){ let l = new Node; this.node.insertChild(l,cnt); this.label[i][j] = l.addComponent(Sprite); const sf = new SpriteFrame(); sf.texture = tex[0]; this.label[i][j].spriteFrame var tex = Array(25).fill(new

Texture 40
article thumbnail

Can't set texture for spriteframe

Cocos

first, I recommend you to follow the TS style when you are coding, that will make your code easy to read. from your code, I guess you want to load some text images and cache them to an array, then you use them to create the spriteFrames when needed. hello ,bro. for example, use let instead of var. the error comes out.

Texture 40
article thumbnail

loadRemote CDN based presigned URL

Cocos

My code is as follows - if ( url.includes("png")) { ext = ".png"; However my node’s sprite’s spriteFrame is still null. However the URL doesnt end with “.png”, png”, hence I am passing the extension as mentioned in the doc.

Texture 40
article thumbnail

How to get an array of pixel colors from an image?

Cocos

I installed extensions in VS C (Cocos Effect, Shader languages support for VS Code) my next thought was to get into the shader to try working with the texture there, but I ran into difficulties: 1.) I couldn’t find the right package for working with textures to get pixel colors #include <common/texture/texture-lod> 2.)

Pixel 52
article thumbnail

[Tutorial]Outer Stroke Effect for 2D Sprites

Cocos

Original: [link] Author: BitByBit Outer Stroke Effect for 2D Sprites Continuing from the previous article Inner Stroke Effect for 2D Sprites Introduction In the last article, we introduced the method of inner stroke and also discussed its pros and cons. _OutlineSize is the stroke width. It is roughly as shown below.

Sprite 52