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)[source]¶
Bases:
BaseEffect
Class for generating a dynamic fire effect with wind and color variations. Optimized for performance using numpy arrays and pre-computed values.
- __init__(buffer: Buffer, background: str)[source]¶
Initializes the enhanced fire effect with a buffer and a background string.
- set_fire_ascii_chars(ascii_chars: str)[source]¶
Set the ASCII characters used for the fire effect.
This method allows customization of the ASCII character set used to represent different intensity levels of the fire effect, enabling various visual styles.
- Parameters:
ascii_chars (str) – A string of exactly 10 characters that represent different intensity levels of the fire effect. Each character corresponds to increasing intensity from low to high.
- Returns:
- Returns nothing, but updates the ascii_chars attribute if the
provided string is valid.
- Return type:
None
Note
The provided ascii_chars string must be exactly 10 characters long. If it is not, the method will return without making any changes.
- set_fire_intensity(fire_intensity: float)[source]¶
Sets the intensity of the fire effect.
- Parameters:
fire_intensity (float) – A value between 0 and 1 representing the intensity of the fire effect. Higher values result in a more intense fire.
- Returns:
- Returns nothing, but updates the fire_intensity attribute if the
provided value is valid.
- Return type:
None
- set_fire_use_char_color(use_char_color: bool)[source]¶
Enables or disables the use of character color for the fire effect.
- Parameters:
use_char_color (bool) – A boolean indicating whether to use character color.
- Returns:
Updates the use_char_color attribute.
- Return type:
None
- set_fire_background_color(background_color: bool)[source]¶
Enables or disables the background color for the fire effect.
- Parameters:
background_color (bool) – A boolean indicating whether to show the background color.
- Returns:
Updates the background_color attribute.
- Return type:
None
- set_fire_turbulence(turbulence: float)[source]¶
Sets how chaotic the fire behaves.
- Parameters:
turbulence (float) – A value between 0.0 and 1.0 representing the level of chaos.
- Returns:
Updates the turbulence attribute.
- Return type:
None
Note
Values closer to 0.0 result in less chaotic behavior, while values close to 1.0 result in more chaos.
- set_fire_heat_spot_intensity(heat_spot_intensity: float)[source]¶
Sets the intensity of heat spots for the fire effect.
- Parameters:
heat_spot_intensity (float) – A value between 0 and 1 representing the intensity of heat spots. Higher values result in more intense heat spots.
- Returns:
Updates the heat_spot_intensity attribute if the provided value is valid.
- Return type:
None
- get_colored_char(intensity: float, max_intensity: float = 255.0) str [source]¶
Returns a colored character for the fire effect based on its intensity.
- update_data(frame_number: int)[source]¶
Updates the fire effect data for the current frame.
- Parameters:
frame_number (int) – The number of the current frame.
- Returns:
This method does not return any value.
- Return type:
None