UV序列幀動畫

2022-07-26 22:18:14 字數 657 閱讀 4286

通過上圖實現乙個火焰的序列幀動畫(使用uv實現美術只需要出一張圖,而不用每個火焰狀態出一張圖,節省了記憶體)。

shader如下:

shader "

custom/uvanimation

" _animationspeed(

"animationspeed

", float) = 100

// _framecount("

framecount

",float) = 12

//這個動畫共幾幀

}

subshader

blend srcalpha oneminussrcalpha

pass

;//處理動畫邏輯

float2 moveuv(float2 vertuv)

}return vertuv * uvscale + float2((_framecount - 1) * uvscale.x, 0.0

); }

half4 frag(v2f i):color

endcg}}

}

序列幀動畫

關於影象的例項化 1.imagenamed 系統推薦使用的,但是影象是例項化之後的釋放由系統負責,如果要自己釋放,不能使用imagenamed方法。2.如果要自己釋放,需要使用imagewithcontentsoffile nsstring path nsbundle mainbundle path...

iOS序列幀動畫

方法1 uiimage animatedimagewithimages 動畫陣列duration 持續時間 可以獲取乙個能做動畫的uiimage物件 方法2 self.imageview.animationimages array 裝的陣列 需要做動畫的陣列 self.imageview.anima...

序列幀動畫Shader

效果圖如下圖所示 原理 控制紋理uv。隨時間改變x軸 tiling,來顯示單個火焰,再改變x軸的offset來位移紋理切換其他火焰 shader upgrade note replaced mul unity matrix mvp,with unityobjecttoclippos shader c...