Message Boards Message Boards

Sea worms: translating from P5.JS Processing to Wolfram using LLM AI-reasoner models

Sea worms: translating from P5.JS Processing to Wolfram using LLM AI-reasoner models

Attachments:
POSTED BY: Vitaliy Kaurov
2 Replies

Nice! I asked o-3-mini-high to do the same and enhance the sea creatures with rainbow colors. Here’s the code:

(*---Define the Sea Creature Functions---*)
  (*First Sea Creature*)
  a1[x_, y_, t_] := Module[{k, e, o, q, c, tanTerm}, k = x/4 - 12.5;
   e = y/9 + 5;
   o = Sqrt[k^2 + e^2]/9;
   (*Protect against division by zero in Tan[1/k]*)
   tanTerm = If[Abs[k] < 10^-6, Tan[1/(k + 10^-6)], Tan[1/k]];
   q = x + 99 + tanTerm + o*k*((Cos[9*e]/4) + Cos[y/2])*Sin[4*o - t];
   c = o*e/30 - t/8;
   {q*0.7*Sin[c] + 9*Cos[y/19 + t] + 200, 200 + (q/2)*Cos[c]}];

(*Second Sea Creature*)
a2[x_, y_, t_] := Module[{k, e, o, q, c}, k = x/4 - 12.5;
   e = y/9;
   o = Sqrt[k^2 + e^2]/9;
   (*Protect against division by zero in Cos[9/k]*)
   q = x + 99 + Cos[9/(If[Abs[k] < 10^-6, k + 10^-6, k])] + 
     o*k*((Cos[9*e]/3) + (Cos[y/9]/0.7))*Sin[4*o - t];
   c = o*e/30 - t/8;
   {q*0.7*Sin[c] + 200, 200 + y/9*Cos[4*c - t/2] - (q/2)*Cos[c]}];


(*---Create a List of Frames for the Animation---*)

(*Adjust the number of frames and step size as desired.\
Here t runs from 0 to 16\[Pi] in 101 steps.*)
frames = 
  Table[Rasterize@
    Graphics[{(*First Sea Creature:20,000 points with rainbow hues*)
      Table[{Hue[i/20000, 1, 1], Opacity[0.3], PointSize[0.0025], 
        Point[a1[Mod[i, 100], i/100, t]]}, {i, 1, 
        20000}],(*Second Sea Creature:30,000 points with rainbow hues*)
      Table[{Hue[i/30000, 1, 1], Opacity[0.3], PointSize[0.0025], 
        Point[a2[Mod[i, 100], i/150, t]]}, {i, 1, 30000}]}, 
     PlotRange -> {{20, 380}, {-40, 430}}, 
     Background -> GrayLevel[6/255], ImageSize -> 550, 
     AspectRatio -> 1, Axes -> False, Frame -> False], {t, 0, 
    16 Pi, (16 Pi)/100}  (*This produces 101 frames;adjust as needed*)];

FrameListVideo[frames, FrameRate -> 10]

enter image description here

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract