Una colonia de medusas nadando: Renderizado trigonométrico y booleano

por Vitaliy Kaurov
Publicación original
Arte original:
◼
  • https://x.com/yuruyurau/status/1979111285951467874
  • Código JS de procesamiento:
    a=(y,d=(mag(k=5*cos(i/48),e=5*cos(y/9))/(6+i%4))**4+4)=>point((q=k*(3+e/2*sin(d*8+k/9-t))-3*sin(k*d/3)-~(i&1)*80)*sin(c=d-t/9+i%5)+200,q*cos(c-i%2+i%5*3+7)+200)
    t=0,draw=$=>{t||createCanvas(w=400,w);background(9).stroke(w,96);for(t+=PI/60,i=3e4;i--;)a(i/799)}/

    Animación de Manipulate

    DynamicModule[{​​ n = 30000, ​​ iInt, i, k, e, d, mod5, termBitwise, cBase, yPhase, pts​​ },​​ ​​ (*Static Precomputation*)​​ iInt = Range[n - 1, 0, -1];​​ i = N[iInt]; (* Float version for trig functions *)​​ ​​ k = 5.0 Cos[i / 48.0];​​ e = 5.0 Cos[(i / 799.0) / 9.0];​​ d = (Sqrt[k^2 + e^2] / (6.0 + Mod[iInt, 4]))^4 + 4.0;​​ ​​ termBitwise = -BitNot[BitAnd[iInt, 1]] * 80.0;​​ ​​ mod5 = Mod[iInt, 5];​​ ​​ (* Pre-calculate phases independent of t *)​​ cBase = d + mod5; ​​ yPhase = -(Mod[iInt, 2]) + mod5 * 3.0 + 7.0;​​ ​​ (*Animation Interface*)​​ Manipulate[​​ pts = With[{​​ c = cBase - t / 9.0,​​ innerSin = Sin[d * 8.0 + k / 9.0 - t]​​ },​​ With[{​​ q = k * (3.0 + e / 2.0 * innerSin) - 3.0 Sin[k * d / 3.0] + termBitwise​​ },​​ (* Construct point list {x, y} *)​​ Transpose[{​​ q * Sin[c] + 200.0, ​​ 200.0 - (q * Cos[c + yPhase])​​ }]​​ ]​​ ];​​ ​​ (*Rendering*)​​ Graphics[​​ {​​ Directive[White, Opacity[1], AbsolutePointSize[1]],​​ Point[pts]​​ },​​ Background -> GrayLevel[0],​​ PlotRange -> {{0, 400}, {0, 400}},​​ ImageSize -> 550​​ ],​​ {{t, 0, "Time"}, 0, 18 Pi},​​ SaveDefinitions->True​​ ]​​ ]
    Out[]=
    ​
    Time

    Animación GiF

    In[]:=
    Module[​​{n = 30000, iInt, i, k, e, d, mod5, termBitwise, cBase, yPhase, pts},​​ iInt = Range[n - 1, 0, -1];​​ i = N[iInt];​​ k = 5.0 Cos[i/48.0];​​ e = 5.0 Cos[(i/799.0)/9.0];​​ d = (Sqrt[k^2 + e^2]/(6.0 + Mod[iInt, 4]))^4 + 4.0;​​ termBitwise = -BitNot[BitAnd[iInt, 1]]*80.0;​​ mod5 = Mod[iInt, 5];​​ cBase = d + mod5;​​ yPhase = -(Mod[iInt, 2]) + mod5*3.0 + 7.0;​​ frames =ParallelTable[​​ pts = With[{c = cBase - t/9.0, innerSin = Sin[d*8.0 + k/9.0 - t]},​​ With[{q = k*(3.0 + e/2.0*innerSin) - 3.0 Sin[k*d/3.0] + termBitwise},​​ Transpose[{q*Sin[c] + 200.0, 200.0 - (q*Cos[c + yPhase])}]]];​​ Graphics[{Directive[White, Opacity[.5], PointSize[.002]], ​​ Point[pts]}, Background -> GrayLevel[0], ​​ PlotRange -> 400{{0, 1}, {0, 1}}, ImageSize -> 550,PlotLabel->Framed[Style[​​ "WOLFRAM FUNCTIONS:\nSin, Cos, Mod, Power, BitAnd, BitNot",​​ 43,GrayLevel[.6],FontFamily->"DIN Condensed"],FrameStyle->Black,FrameMargins10]], ​​ {t, 0, 18 Pi, 18 Pi/300.}]];
    In[]:=
    Export["fishyjelly2.gif",frames,ImageSize->550,"DisplayDurations"->.03]
    Out[]=
    fishyjelly2.gif

    Animación MP4

    In[]:=
    Module[​​{n = 30000, iInt, i, k, e, d, mod5, termBitwise, cBase, yPhase, pts},​​ iInt = Range[n - 1, 0, -1];​​ i = N[iInt];​​ k = 5.0 Cos[i/48.0];​​ e = 5.0 Cos[(i/799.0)/9.0];​​ d = (Sqrt[k^2 + e^2]/(6.0 + Mod[iInt, 4]))^4 + 4.0;​​ termBitwise = -BitNot[BitAnd[iInt, 1]]*80.0;​​ mod5 = Mod[iInt, 5];​​ cBase = d + mod5;​​ yPhase = -(Mod[iInt, 2]) + mod5*3.0 + 7.0;​​ AnimationVideo[​​ pts = With[{c = cBase - t/9.0, innerSin = Sin[d*8.0 + k/9.0 - t]},​​ With[{q = k*(3.0 + e/2.0*innerSin) - 3.0 Sin[k*d/3.0] + termBitwise},​​ Transpose[{q*Sin[c] + 200.0, 200.0 - (q*Cos[c + yPhase])}]]];​​ Graphics[{Directive[White, Opacity[.3], PointSize[.002]], ​​ Point[pts]}, Background -> GrayLevel[0], ​​ PlotRange -> 400{{0, 1}, {0, 1}}, ImageSize -> 720{.8,1},PlotLabel->Framed[Style[​​ "WOLFRAM FUNCTIONS:\nSin, Cos, Mod, Power, BitAnd, BitNot",​​ 50,GrayLevel[.6],FontFamily->"DIN Condensed"],FrameStyle->Black,FrameMargins10]], ​​ {t, 0, 18 Pi},DefaultDuration->18,RasterSize-> 720{.8,1}]];

    CITE ESTE CUADERNO

    Una colonia de medusas nadando: Renderizado trigonométrico y booleano​
    por Vitaliy Kaurov​
    Comunidad Wolfram, STAFF PICKS, 4 de diciembre de 2025
    ​https://community.wolfram.com/groups/-/m/t/3585501