let scrollingBg = new ScrollingBg(CG.Base.resourceManager.getPixiTexture('texture.alias'), 1000, ScrollingBg.RIGHT, true)
- 參數1: 材質
- 參數2: 週期(毫秒)
- 參數3: 角度(不是弧度喔)
- 參數4: 要不要播放
然後把scrollingBg加入你要顯示的Container裡面就OK了
如果你想要多層捲軸的話除了新增好幾個ScrollingBg以外,有一個工具ScrollingBgGroup:
let scrollingBgGroup = new ScrollingBgGroup([
CG.Base.resourceManager.getPixiTexture('LearningWonderlandFOBsp.bg_4'),
CG.Base.resourceManager.getPixiTexture('LearningWonderlandFOBsp.bg_3'),
CG.Base.resourceManager.getPixiTexture('LearningWonderlandFOBsp.bg_2'),
CG.Base.resourceManager.getPixiTexture('LearningWonderlandFOBsp.bg_1'),
CG.Base.resourceManager.getPixiTexture('LearningWonderlandFOBsp.bg_0'),
], 1000, 1.5, -45, true)
- 參數1: 材質陣列,疊起來的順序(索引0是最底層的)
- 參數2: 最高層週期(毫秒)
- 參數3: 次方,就是每層的速度變化,越大越明顯
- 參數4: 角度
- 參數5: 要不要播放
想了解細節的話可以去看原始碼喔~