Message Boards Message Boards

[GIF] Twinkle (Pseudo-randomly located oscillators)

GROUPS:

Pseudo-randomly located oscillators

Twinkle

Inspired by Jerome Herr. Here's the code:

DynamicModule[{points, startθ, cols},
 cols = RGBColor /@ {"#598EA3", "#B0DDDF", "#F0AB7B", "#2D4861"};
 points = 
  RandomVariate[
   TransformedDistribution[
    r {Cos[θ], Sin[θ]}, {r \[Distributed] 
      NormalDistribution[1, 1/8], θ \[Distributed] 
      UniformDistribution[{0, 2 π}]}], 1000];
 startθ = RandomReal[{0, 2 π}, 1000];
 Manipulate[
  Graphics[{Table[{cols[[Mod[i, 3, 1]]], 
      PointSize[.0065 + .0025 Sin[θ + startθ[[i]]]], 
      Point[points[[i]]]}, {i, 1, 1000}]}, Background -> cols[[4]], 
   PlotRange -> 1.9, ImageSize -> 540], {θ, 0, 2 π}]
 ]
POSTED BY: Clayton Shonkwiler
Answer
1 year ago

This feels like something that could pop up in a Doctor Who episode, where it would of course contain a subliminal alien message. Wolfram Research, what have you done with RandomVariate? And don't tell me it's "random".

POSTED BY: Bianca Eifert
Answer
1 year ago

Wait, what's wrong with RandomVariate?

POSTED BY: Clayton Shonkwiler
Answer
1 year ago

I'm sorry, I can't quite tell if you're playing along or if my joke was too silly to register as a joke... this forum needs smilies!

(Either way I enjoy the animation, obviously!)

POSTED BY: Bianca Eifert
Answer
1 year ago

Sorry, literalism gene kicked in there. Anyway, thanks for the kind words!

POSTED BY: Clayton Shonkwiler
Answer
1 year ago

enter image description here - another post of yours has been selected for the Staff Picks group, congratulations !

We are happy to see you at the tops of the "Featured Contributor" board. Thank you for your wonderful contributions, and please keep them coming!

POSTED BY: Moderation Team
Answer
1 year ago

That's beautiful!
I'm using Animate instead of Manipulate to have it play "live" in the notebook.

POSTED BY: Updating Name
Answer
1 year ago

Group Abstract Group Abstract