[GIF] Twinkle (Pseudo-randomly located oscillators)

scatter11.gif

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 ?}]
 ]
7 Likes

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”.

1 Like

Wait, what’s wrong with RandomVariate?

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!)

2 Likes

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

1 Like

2015-11-02_10-07-11.png

  • 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!