我需要帮助。我遇到了一个与我的动态壁纸中的粒子系统有关的问题。我不知道如何使雪花向下倾斜更加逼真,增加摆动动作。这里是代码
final int mParticleX = CAMERA_WIDTH/2;
final int mParticleY = 1;
final int mParticleWidth = CAMERA_WIDTH;
final int mParticleHeight = 1;
//Set the max and min rates that particles are generated per second
final int mParticleMinRate = 2;
final int mParticleMaxRate = 5;
//Set a variable for the max particles in the system.
final int mParticleMax = 100;
/* Create Particle System.
* Changed to BatchedSpriteParticleSystem to improve performance
* and reduce battery usage*/
final BatchedSpriteParticleSystem particleSystem = new BatchedSpriteParticleSystem
(new RectangleParticleEmitter(mParticleX, mParticleY, mParticleWidth, mParticleHeight),
mParticleMinRate, mParticleMaxRate, mParticleMax,
this.mSnowflakeTextureRegion, this.getVertexBufferObjectManager());
particleSystem.addParticleInitializer(new BlendFunctionParticleInitializer<UncoloredSprite>(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE));
// set initial velocity
this.mVelocityParticleInitializer = new VelocityParticleInitializer<UncoloredSprite>(-100, 100, 20, 190);
particleSystem.addParticleInitializer(this.mVelocityParticleInitializer);
// add gravity so the particles fall downward
particleSystem.addParticleInitializer(new GravityParticleInitializer<UncoloredSprite>());
// add acceleration so particles float
particleSystem.addParticleInitializer(new AccelerationParticleInitializer<UncoloredSprite>(-3, 3, -3, -5));
// add a rotation to particles
particleSystem.addParticleInitializer(new RotationParticleInitializer<UncoloredSprite>(0.0f, 360.0f));
OffCameraExpireParticleModifier<UncoloredSprite>offCameraExpireParticleModifier= new OffCameraExpireParticleModifier<UncoloredSprite>(mCamera);
particleSystem.addParticleModifier(offCameraExpireParticleModifier);
// change rotation of particles at various times
particleSystem.addParticleModifier(new RotationParticleModifier<UncoloredSprite>(0.0f, 5.0f, 0.0f, -180.0f));
particleSystem.addParticleModifier(new RotationParticleModifier<UncoloredSprite>(5.0f, 15.0f, -180.0f, 90.0f));
particleSystem.addParticleModifier(new RotationParticleModifier<UncoloredSprite>(20.0f, 30.0f, 90.0f, 0.0f));
particleSystem.addParticleModifier(new RotationParticleModifier<UncoloredSprite>(30.0f, 40.0f, 0.0f, -90.0f));
// add some fade in and fade out to the particles
particleSystem.addParticleModifier(new AlphaParticleModifier<UncoloredSprite>(0.0f, 1.0f, 0.0f, 1.0f));
particleSystem.addParticleModifier(new AlphaParticleModifier<UncoloredSprite>(6.0f, 10.0f, 1.0f, 0.0f));
// attach particle system to scene
this.mScene.attachChild(particleSystem);
createSceneCallback.onCreateSceneFinished(mScene);