MCPcopy Create free account
hub / github.com/FastLED/FastLED / resetParticle

Function resetParticle

examples/Luminova/Luminova.h:59–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57P ps[MAXP];
58
59void resetParticle(P &p, uint32_t tt) {
60 // Original: x=360,y=360 (center), a=t*1.25 + noise(I)*W, f=t%2*2-1, g=I,
61 // s=5
62 int I = (int)(tt / 50);
63 p.x = (WIDTH - 1) / 2.0f;
64 p.y = (HEIGHT - 1) / 2.0f;
65
66 // noise(I)*W -> use 1D Perlin noise via inoise8
67 uint8_t n1 = inoise8(I * 19); // arbitrary scale
68 float noiseW = (n1 / 255.0f) * WIDTH;
69
70 p.a = tt * 1.25f + noiseW; // base angle component
71 p.f = (tt & 1) ? +1 : -1; // alternate direction
72 p.g = I;
73 p.s = 3.0f; // lower initial intensity for small grids
74 p.alive = true;
75}
76
77inline void plotDot(int x, int y, uint8_t v) {
78 if (x < 0 || x >= WIDTH || y < 0 || y >= HEIGHT)

Callers 2

drawMethod · 0.85
loopFunction · 0.85

Calls 1

inoise8Function · 0.85

Tested by

no test coverage detected