[]粒子在webgl情况和canvas情况存在显著差异,请看图

ezgif-4-c4fd2c93b5.gif

 
 
但是在webgl的情况下,同样的设置,个数计算明显不对,颜色也存在很大差异,相比 canvas情况下 颜色更接近设置的

ezgif-5-60bccbb5c0.gif

(function()
{
var Stage = Laya.Stage;
var Loader = Laya.Loader;
var Particle2D = Laya.Particle2D;
var Browser = Laya.Browser;
var Handler = Laya.Handler;
var Stat = Laya.Stat;
var WebGL = Laya.WebGL;

var sp;

(function()
{
// 不支持WebGL时自动切换至Canvas
Laya.init(Browser.clientWidth, Browser.clientHeight, WebGL);

Laya.stage.alignV = Stage.ALIGN_MIDDLE;
Laya.stage.alignH = Stage.ALIGN_CENTER;

Laya.stage.scaleMode = "showall";
Laya.stage.bgColor = "#232628";

Stat.show();

Laya.URL.basePath += "../../";
Laya.loader.load("res/particles/GravityMode.part", Handler.create(this, onAssetsLoaded), null, Loader.JSON);
})();

function onAssetsLoaded(settings)
{
data = {
"minStartColor": {
"0": 1,
"1": 0,
"2": 0,
"3": 1
},
"boxEmitterVelocity": {
"0": 0,
"1": 0,
"2": 0
},
"minHorizontalStartRadian": 0,
"positionVariance": {
"0": 0,
"1": 0,
"2": 0
},
"maxHorizontalVelocity": 0,
"sphereEmitterRadius": 1,
"backColor": "#000000",
"minRotateSpeed": 0,
"gravity": {
"0": 0,
"1": 0,
"2": 0
},
"maxColor": {
"0": 0.57,
"1": 1,
"2": 0,
"3": 1
},
"emitterVelocitySensitivity": 1,
"minStartSize": 4.79,
"duration": 11.69,
"sphereEmitterVelocity": 0,
"minStartRadius": 0,
"disableColor": true,
"boxEmitterSize": {
"0": 0,
"1": 0,
"2": 0
},
"pointEmitterVelocityAddVariance": {
"0": 0,
"1": 0,
"2": 0
},
"maxHorizontalStartRadian": 0,
"maxEndSize": 0,
"maxEndColor": {
"0": 0,
"1": 1,
"2": 0,
"3": 1
},
"maxHorizontalEndRadian": 0,
"maxStartSize": 27.79,
"ringEmitterVelocityAddVariance": 0,
"blendState": 1,
"useEndRadian": true,
"pointEmitterPositionVariance": {
"0": 0,
"1": 0,
"2": 0
},
"minVerticalEndRadian": 11.14,
"maxRotateSpeed": 0,
"ringEmitterUp": 2,
"ringEmitterRadius": 30,
"minEndSize": 11.69,
"sphereEmitterCenterPosition": {
"0": 0,
"1": 0,
"2": 0
},
"maxVerticalEndRadian": 20.42,
"pointEmitterVelocity": {
"0": 0,
"1": 0,
"2": 0
},
"maxPartices": 100,
"minVerticalStartRadian": 0,
"sphereEmitterVelocityAddVariance": 0,
"maxVerticalVelocity": -30,
"minEndRadius": 0,
"maxStartRadius": 0,
"minEndColor": {
"0": 0,
"1": 1,
"2": 0,
"3": 1
},
"textureFileName": "comp\\clip_num.png",
"emissionRate": 0,
"minHorizontalVelocity": 0,
"emitterType": "null",
"textureCount": 1,
"minVerticalVelocity": 0,
"boxEmitterVelocityAddVariance": {
"0": 0,
"1": 0,
"2": 0
},
"ringEmitterCenterPosition": {
"0": 0,
"1": 0,
"2": 0
},
"maxVerticalStartRadian": 0,
"ageAddScale": 3.26,
"maxStartColor": {
"0": 1,
"1": 0,
"2": 0,
"3": 1
},
"minColor": {
"0": 0.15,
"1": 0.92,
"2": 0.91,
"3": 0.6000000238
},
"ringEmitterVelocity": 0,
"textureName": "https://s2.d2scdn.com/2018/01/ ... ot%3B,
"minHorizontalEndRadian": 0,
"boxEmitterCenterPosition": {
"0": 0,
"1": 0,
"2": 0
},
"pointEmitterPosition": {
"0": 0,
"1": 0,
"2": 0
},
"colorComponentInter": false,
"endVelocity": 1,
"maxEndRadius": 0
}
sp = new Particle2D(data);
sp.emitter.start();
sp.play();
Laya.stage.addChild(sp);

sp.x = Laya.stage.width / 2;
sp.y = Laya.stage.height / 2;
}
})();
canvas 和webgl 自行切換
已邀请:

qian

赞同来自:

可以发一个例子么

要回复问题请先

商务合作
商务合作