Matrix 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.matrix_effect.MatrixEffect(buffer: Buffer, background: str, chracter_halt_range: tuple[int] = (1, 2), color_halt_range: tuple[int] = (1, 2), character_randomness_one: float = 0.7, character_randomness_two: float = 0.6, color_randomness: float = 0.5, gradient_length: int = 1)[source]¶
Bases:
BaseEffect
Effect to mimic the cliche coding backgroud with falling random characters.
- __init__(buffer: Buffer, background: str, chracter_halt_range: tuple[int] = (1, 2), color_halt_range: tuple[int] = (1, 2), character_randomness_one: float = 0.7, character_randomness_two: float = 0.6, color_randomness: float = 0.5, gradient_length: int = 1)[source]¶
Initialize the MatrixEffect class.
- Parameters:
buffer (Buffer) – Effect buffer to push changes to.
background (str) – Character or string used for the background.
chracter_halt_range (tuple[int], optional) – Halt range. Defaults to (1, 2).
color_halt_range (tuple[int], optional) – Halt range. Defaults to (1, 2).
character_randomness_one (float, optional) – Frequency to update a character. Defaults to 0.70.
character_randomness_two (float, optional) – Frequency to update a character. Defaults to 0.60.
color_randomness (float, optional) – Frequency to move the color gradient. Defaults to 0.50.
gradient_length (int, optional) – Length of the color gradient. Defaults to 1.
- set_matrix_properties(chacter_halt_range: tuple[int] = (1, 2), color_halt_range: tuple[int] = (1, 2), character_randomness_one: float = 0.7, character_randomness_two: float = 0.6, color_randomness: float = 0.5, gradient_length: int = 1)[source]¶
Set the matrix properties for the MatrixEffect.
- Parameters:
chracter_halt_range (tuple[int], optional) – Halt range. Defaults to (1, 2).
color_halt_range (tuple[int], optional) – Halt range. Defaults to (1, 2).
character_randomness_one (float, optional) – Frequency to update a character. Defaults to 0.70.
character_randomness_two (float, optional) – Frequency to update a character. Defaults to 0.60.
color_randomness (float, optional) – Frequency to move the color gradient. Defaults to 0.50.
gradient_length (int, optional) – Length of the color gradient. Defaults to 1.
- set_matrix_gradient(gradient: list[int])[source]¶
Set the base gradient of the matrix. This will reset the current gradient and recreate it based on the new base gradient.