◼
  • Original JS processing p5.js code: https://x.com/yuruyurau/status/1966894529954673142.
  • ◼
  • By @yuruyurau https://x.com/yuruyurau
  • a=(y,d=mag(k=(y<9?4+sin(y^8)*9:y/4+cos(y))*cos(i),e=y/6-13)+cos(i/1199)/2)=>point((q=y*k/d*(2+sin(d*2+y-t*16))+79)*cos(c=d/6-t+(i&5))+200,q*d/9*sin(c+i%2*7)+200)
    t=0,draw=$=>{t||createCanvas(w=400,w);background(9).stroke(w,56);for(t+=PI/480,i=2e4;i--;)a(i/980)}

    APPARENT ANIMACY

    Apparent animacy is the perception of lifelike agency from minimal motion cues in otherwise simple shapes or dots.
    In a 1944 short film, two triangles and a circle move around a box. Viewers report a bully, a chase, a rescue. No faces. Just motion. Later studies showed the recipe in simple cues: a dot that starts on its own, speeds up or slows down, turns sharply, or reacts to another dot reads as self-propelled and goal-directed. Those cues are enough for the visual system to upgrade drifting points into living agents. Today these frameworks are standard tools in perception labs and in AI systems that try to read goals from motion.

    CODE

    Initializing the number of points (n) to be used and creating lists of indices iList and corresponding y values
    yList
    .
    n = 20000;​​iList = Range[0, n - 1];​​yList = N[iList/980.];
    Computing two lists for the bitwise AND operation results, and the modulo operation results for each index divided by 2, then calculating the sine of the bitwise XOR operation
    iAnd5 = BitAnd[iList, 5];​​iMod2 = Mod[iList, 2];
    sinXor = N @ Sin[BitXor[Floor[yList], 8]];
    This code generates the
    sTermList
    , where each element is computed based on a condition applied to
    yList
    and
    sinXor
    . If a
    yList
    element is less than 9, the formula
    4 + 9 * sinXor
    is used; otherwise, the formula
    y / 4 + Cos[y]
    is applied.
    sTermList = MapThread[​​ If[#1 < 9., 4. + 9. #2, #1/4. + Cos[#1]] &,​​ {yList, sinXor}​​];
    kList = sTermList * Cos[N[iList]];​​eList = yList/6. - 13.;​​dBase = Sqrt[kList^2 + eList^2] + Cos[N[iList/1199.]]/2.;
    Defining a function that generates text labels in certain style
    In[]:=
    ClearAll[coner];​​coner[fl_,vo_:.035]:=Prepend[​​MapIndexed[Text[Style[#,19,
    ,FontFamily->"Georgia"],Scaled[{.01,.99-vo #2[[1]]}],{Left,Top}]&,fl],​​Text[Style[ToUpperCase@"Wolfram functions:",21,
    ,FontFamily->"DIN Condensed"],Scaled[{.01,.99}],{Left,Top}]​​]
    Generating text labels for some used functions
    In[]:=
    conLBL=coner[{BitAnd,BitXor,Power,Floor,Mod,Sin, Cos},.035];
    Defining a function that creates a single frame of the animation based on the input time t.
    (* Single-frame renderer *)​​frame[t_?NumericQ] := Module[​​ {d = dBase, y = yList, k = kList, b5 = N@iAnd5, m2 = N@iMod2, c, q, x, ypix},​​ c = d/6. - t + b5;​​ q = y*k/d*(2. + Sin[d*2. + y - 16. t]) + 79.;​​ x = q*Cos[c] + 200.;​​ ypix = q*d/9.*Sin[c + m2*7.] + 200.;​​ Graphics[​​ {conLBL,PointSize[.0025], White, Opacity[.7],Point[Transpose[{x, ypix}]]},​​ PlotRange -> {{80, 320}, {50, 350}},​​ Background -> Black,​​ ImageSize -> 550​​ ]​​];
    Creating the animation
    In[]:=
    Manipulate[frame[t],{t,0,2 π },SaveDefinitions->True]
    Out[]=
    ​
    t
    In[]:=
    SetDirectory[NotebookDirectory[]]
    Out[]=
    /Users/vitaliyk/Documents/LiNKEDiN/yuruyurau/*4 medusaas
    Generating list of animation frames to be exported as a GIF file
    frames=Table[frame[t],{t, 0, 2*Pi,2*π/(400.-1)}];
    Export["four_medusas.gif",frames,"DisplayDurations"->.05,ImageSize->550]

    References

    ◼
  • Heider, F., & Simmel, M. (1944). An experimental study of apparent behavior. The American Journal of Psychology, 57(2), 243–259. PDF
  • ◼
  • Tremoulet, P. D., & Feldman, J. (2000). Perception of animacy from the motion of a single object. Perception, 29(8), 943–951. PDF – Journal page
  • ◼
  • Scholl, B. J., & Gao, T. (2013). Perceiving animacy and intentionality: Visual processing or higher-level judgment? In M. D. Rutherford & V. A. Kuhlmeier (Eds.), Social perception: Detection and interpretation of animacy, agency, and intention (pp. 197–230). MIT Press. PDF
  • ◼
  • Gao, T., Newman, G. E., & Scholl, B. J. (2009). The psychophysics of chasing: A case study in the perception of animacy. Cognitive Psychology, 59(2), 154–179. PDF
  • ◼
  • Tremoulet, P. D., & Feldman, J. (2000). Perception of Animacy from the Motion of a Single Object. Perception, 29(8), 943-951. https://doi.org/10.1068/p3101 (Original work published 2000)
  • CITE THIS NOTEBOOK

    Four medusas: apparent animacy in motion of points driven by simple math functions​
    by Vitaliy Kaurov​
    Wolfram Community, STAFF PICKS, September 19, 2025
    ​https://community.wolfram.com/groups/-/m/t/3547363