Fire Effect¶
Copyright 2023 Ethan Christensen
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class bruhanimate.bruheffect.fire_effect.FireEffect(buffer: Buffer, background: str, settings: FireSettings = None)[source]¶
Bases:
BaseEffectClass for generating a dynamic fire effect with taller, rounder, and more visible flames using fuller ASCII characters.
- __init__(buffer: Buffer, background: str, settings: FireSettings = None)[source]¶
Initializes the fire effect.
- Parameters:
buffer (Buffer) – Effect buffer to push updates to.
background (str) – Character or string to use as the background.
settings (FireSettings, optional) – Configuration for the fire effect. Defaults to None.
- set_fire_ascii_chars(ascii_chars: str)[source]¶
Sets the ASCII characters used for the fire effect.
- Parameters:
ascii_chars (str) – Exactly 10 characters to use for the fire gradient.
- set_fire_intensity(fire_intensity: float)[source]¶
Sets the intensity of the fire effect.
- Parameters:
fire_intensity (float) – Value between 0 and 1.
- set_fire_use_char_color(use_char_color: bool)[source]¶
Enables or disables character color rendering.
- Parameters:
use_char_color (bool) – Whether to color the ASCII characters.
- set_fire_background_color(background_color: bool)[source]¶
Enables or disables background color rendering.
- Parameters:
background_color (bool) – Whether to render as colored background blocks.
- set_fire_swell(swell: bool, swell_halt: int = 1)[source]¶
Controls intensity oscillation (breathing effect).
- set_fire_turbulence(turbulence: float)[source]¶
Sets how chaotic the fire behaves.
- Parameters:
turbulence (float) – Value between 0 and 1.
- set_fire_heat_spot_intensity(heat_spot_intensity: float)[source]¶
Sets the intensity of heat spots.
- Parameters:
heat_spot_intensity (float) – Value between 0 and 1.
- get_colored_char(intensity: float, max_intensity: float = 255.0) str[source]¶
Returns a colored character based on fire intensity.
- update_data(frame_number: int)[source]¶
Updates the fire simulation data for one frame.
- Parameters:
frame_number (int) – The current frame number.