16.03.2024, 17:06
Does:
seem correct to you to calculate the weights?
Cu Selur
import math
def weights(frames, mode):
if frames % 2 == 0 or frames > 31:
raise ValueError("Frames must be an odd number less than or equal to 31.")
if mode not in ['left', 'center', 'right']:
raise ValueError("Mode must be 'left', 'center', or 'right'.")
array = [0] * frames
if mode == 'center':
array = [100 // frames] * frames
array[frames // 2] = array[frames // 2] + 100 % frames
else:
array[:(frames // 2) - 1] = [100 // (frames // 2 + 1 ) + 1] * (frames // 2)
array[frames // 2] = 100 // (frames // 2 + 1) - (frames // 2)
if mode == 'right':
array = array[::-1]
return array
# Example usage:
frames = 7
mode = 'left'
result = weights(frames, mode)
print(result)
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.