3. 在脚本中编写下面代码:
shader_type canvas_item;
uniform bool open =false;
uniform vec4 color:source_color;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
// Called for every pixel the material is visible on.
if(open){
if(texture(TEXTURE,UV).a>0.){
COLOR = color;
}
}
}
4. 手动开关open属性,可以看到闪烁效果
5. 创建AnimationPlayer节点,添加“属性轨道”,给open的值key帧(true-false-true-false)
6. 播放动画,就可以看到闪烁效果