-1

How to make an animation of following gif by using Mathematica?

enter image description here

vito
  • 8,958
  • 1
  • 25
  • 67

1 Answers1

12

You can use the new RandomPoint- function to sample points from a sphere and use the second argument of Text to position some text in 3D. Text will automatically make the string face towards the viewer/camera for you.

pts = RandomPoint[Sphere[{0, 0, 0}], 100];
Text["test", #] & /@ pts // Graphics3D[#, SphericalRegion -> True, Boxed -> False] &

gif


Another approach is instead of rotating the entire graphic (as done above) to rotate the points themselves via RotationTransform. This enables the use of coordinate dependent color and size. An appropriate transformation could be

r[angle_?NumericQ, pivot : {_, _}] := RotationTransform[angle Degree, pivot];

and can be used as follows to archive something closer to what you are looking for with color and size scaling done in respect to the y-coordinate

Graphics3D[(Style[Text["test", #], FontSize -> 14 - 5*(#[[2]] + 1), 
FontColor -> Blend[{Black, White}, #[[2]]]] & /@ 
r[0, {{0, 0.2, 1}, {1, 0, 0}}] /@ pts), BoxRatios -> {1, 1, 1}, 
Boxed -> True, Axes-> True, AxesLabel -> {"x", "y", "z"}]

picture2

This can be animated for instance like this

Animate[Graphics3D[(Style[Text["test", #], 
FontSize -> 14 - 5*(#[[2]] + 1), 
FontColor -> Blend[{Black, White}, #[[2]]]] & /@ 
r[angle, {{0, 0, 1}, {0.2, -1, 0}}] /@ pts), 
BoxRatios -> {1, 1, 1}, SphericalRegion -> True, Boxed -> False, 
ViewPoint -> Front], {angle, 0, 360}]

final result

To archive your desired look you might have to play around a bit with the color- and size scaling

Sascha
  • 8,459
  • 2
  • 32
  • 66
  • Haha, I got that far. Now how to make it smaller and more transparent the further away it is? – Quantum_Oli Sep 28 '16 at 11:55
  • @Quantum_Oli and Sascha, there is a better one but this one is also related to that problem: 55174 – Kuba Sep 28 '16 at 12:07
  • but I need to rotate graphic without click on. – vito Sep 28 '16 at 12:24
  • @Kuba I remember seeing that one the other day and it crossed my mind when reading this question. However I think even if one has a sphere (or ball) in place with the correct transparency options, the Text objects ignore it and are always drawn on top. I briefly wondered about converting the Text to FilledCurves to attempt to circumvent this but I don't think Graphics3D accepts FilledCurves. – Quantum_Oli Sep 28 '16 at 12:29
  • @Quantum_Oli Use Inset then. – Kuba Sep 28 '16 at 12:29
  • I need another -1 vote on the question... and +18 votes on my answer ...please?:) – Sascha Sep 28 '16 at 13:27
  • 1
    Going for the Reversal age? Good luck. – m_goldberg Sep 28 '16 at 13:32
  • @m_goldberg That was actually more intended as a joke. What bothers me a bit about this kind of questions is that answering them can be fun however discouraged the questions themselves are. – Sascha Sep 28 '16 at 13:36