Source code for bruhanimate.bruheffect.perlin_effect
"""Copyright 2023 Ethan ChristensenLicensed 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 http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License."""importmathimportnumpyasnpfrombruhcolorimportbruhcoloredasbcfrom..bruhutilimportBufferfrom.base_effectimportBaseEffectfrom.settingsimportPerlinSettingsdef_heat(r:float)->int:r=max(0.0,min(1.0,r))ifr<0.25:return17+int(r*4*18)elifr<0.5:return51+int((r-0.25)*4*12)elifr<0.75:return82+int((r-0.5)*4*12)else:return220+int((r-0.75)*4*3)
[docs]classPerlinEffect(BaseEffect):""" Smooth animated noise field. Multiple octaves of sine-wave interference are combined to produce fractal-like smooth noise that scrolls and pulses over time. A configurable threshold gates which parts of the field are drawn, controlling density. Color maps noise intensity through a heat palette when enabled. """