9
$\begingroup$

I know that there is a similar question of taking an animation of 3D object, however since I'm not good at Mathematica nor English, I couldn't figure out how to make animation of multiple objects rotating. Below is the code of graphic I would like to rotate around vector {0,1,0}.

s[x_,y_]:=y/Sqrt[x^2+y^2];
star=RegionPlot3D[x^2+y^2<=(1-3z^2)(3+1.3(1-3z^2)(5s[x,y]-20s[x,y]^3+16s[x,y]^5))&&Abs[z]<=1,{x,-2.2,2.2},{y,-2,2.4},{z,-2,2},PlotPoints->80,PlotStyle->Directive[Yellow],Mesh->None,Axes->False,Boxed->False,ViewPoint->{-1.45,-0.175,1.6},ViewVertical->{0,1,0}];
eye1=RegionPlot3D[(x+0.41)^2/0.005+(y-0.3)^2/0.1+(z-0.52)^2/0.01<=1,{x,-2,2},{y,-2,2},{z,-1.8,1.8},PlotPoints->80,PlotStyle->Directive[Black,Specularity[80]]];
eye2=RegionPlot3D[(x-0.41)^2/0.005+(y-0.3)^2/0.1+(z-0.52)^2/0.01<=1,{x,-2,2},{y,-2,2},{z,-1.8,1.8},PlotPoints->80,PlotStyle->Directive[Black,Specularity[80]]];
Show[star, eye1, eye2]

This is the picture of my graphic. Can somebody help please..?

$\endgroup$
1
  • $\begingroup$ It would be good to provide a link to the question that you think is related. $\endgroup$
    – C. E.
    Commented Sep 29, 2019 at 10:06

1 Answer 1

13
$\begingroup$
s[x_, y_] := y/Sqrt[x^2 + y^2];
star = RegionPlot3D[
   x^2 + y^2 <= (1 - 3 z^2) (3 + 
        1.3 (1 - 3 z^2) (5 s[x, y] - 20 s[x, y]^3 + 16 s[x, y]^5)) && 
    Abs[z] <= 1, {x, -2.2, 2.2}, {y, -2, 2.4}, {z, -2, 2}, 
   PlotPoints -> 80, PlotStyle -> Directive[Yellow], Mesh -> None, 
   Axes -> False, Boxed -> False, ViewPoint -> {-1.45, -0.175, 1.6}, 
   ViewVertical -> {0, 1, 0}];
eye1 = RegionPlot3D[(x + 0.41)^2/0.005 + (y - 0.3)^2/
      0.1 + (z - 0.52)^2/0.01 <= 1, {x, -2, 2}, {y, -2, 2}, {z, -1.8, 
    1.8}, PlotPoints -> 80, 
   PlotStyle -> Directive[Black, Specularity[80]]];
eye2 = RegionPlot3D[(x - 0.41)^2/0.005 + (y - 0.3)^2/
      0.1 + (z - 0.52)^2/0.01 <= 1, {x, -2, 2}, {y, -2, 2}, {z, -1.8, 
    1.8}, PlotPoints -> 80, 
   PlotStyle -> Directive[Black, Specularity[80]]];
p = Show[star, eye1, eye2]

lst = Table[
   Graphics3D[Rotate[p[[1]], 2*Pi*t, {0, 1, 0}], Boxed -> False, 
    Axes -> False], {t, 0, 1, .05}];

ListAnimate[lst]

Figure 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.