def rocket_smoke_mutator(particle: arcade.LifetimeParticle): particle.scale = arcade.lerp( 0.5, 3.0, particle.lifetime_elapsed / particle.lifetime_original) # A Sprite's scale doesn't affect generated textures # (ex: make_soft_circle_texture) or scale being animated over time. # The fix below is copied from Sprite.update_animation(). # Bug may have been recorded here: https://github.com/pvcraven/arcade/issues/331 particle.width = particle._texture.width * particle.scale particle.height = particle._texture.height * particle.scale
def _createWarpEffectEmitter(self) -> Emitter: """ Random particle textures """ texture0 = self._warpEffectTextures[0] texture2 = self._warpEffectTextures[2] e: Emitter = Emitter( center_xy=self._centerPosition, emit_controller=EmitterIntervalWithTime(DEFAULT_EMIT_INTERVAL, DEFAULT_EMIT_DURATION), particle_factory=lambda emitter: LifetimeParticle( filename_or_texture=randomChoice((texture0, texture2)), change_xy=rand_on_circle((0.0, 0.0), PARTICLE_SPEED_FAST), lifetime=DEFAULT_PARTICLE_LIFETIME, scale=DEFAULT_SCALE ) ) return e
def rocket_smoke_mutator(particle: arcade.LifetimeParticle): particle.scale = arcade.lerp( 0.5, 3.0, particle.lifetime_elapsed / particle.lifetime_original)