(*Change the point and vector here and the animation will update*)P1 = {2,1,3};
v1 = {1,2,-1};

arrowP1 = {Red,Thickness[0.005],Arrow[{{0,0,0},P1}]};
arrowV1 = {Gray,Thickness[0.005],Arrow[{{0,0,0},v1}]};
arrowP1V1 = {Blue,Thickness[0.005],Arrow[{P1,v1+P1}]};

LineFrame[t_]:=(s = If[t>2,2-t,t];
linePoint = P1+v1*s;
lineArrow = {Gray,Thickness[0.005],Arrow[{{0,0,0},linePoint}]};
lineStart = If[t>2,linePoint,P1];
lineEnd = If[t>2,P1+v1*2,linePoint];
line = {Blue,Thickness[0.008],Line[{lineStart,lineEnd}]};
vText = Text["v",1.1*v1];
pText = Text["P",1.1*P1];

Show[Graphics3D[{arrowP1,arrowV1,arrowP1V1,vText,pText,lineArrow,line,Text["x",{5.5,0,0}],Text["y",{0,5.5,0}],Text["z",{0,0,5.5}]}],Axes->True,AxesOrigin->{0,0,0},PlotRange->{{-5,5},{-5,5},{-5,5}},Boxed->False,PlotLabel->Style[StringForm@@Join[{"Line through \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"P", "=", 
RowBox[{"(", 
RowBox[{"``", ",", "``", ",", "``"}], ")"}]}], TraditionalForm]]]]]\) in the direction of \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"v", "=", 
RowBox[{"⟨", 
RowBox[{"``", ",", "``", ",", "``"}], "⟩"}]}], TraditionalForm]]]]]\)"},P1,v1],FontSize->16],ViewPoint->{2,.4,.8}])

Animate[LineFrame[t],{t,0,4,0.1}]

plane1 = Plot3D[-1,{x,-2,2},{y,-2,2},PlotStyle->{Blue,Opacity[1]}];
plane2 = Plot3D[0,{x,-2,2},{y,-2,2},PlotStyle->{Red,Opacity[1]}];
plane3 = Plot3D[1,{x,-2,2},{y,-2,2},PlotStyle->{Green,Opacity[1]}];
Show[Graphics3D[{Text["x",{2.1,-2,-1}],Text["y",{2,2.1,-1}],Text["z",{2,-2,1.1}]}],plane1,plane2,plane3,Axes->True,Boxed->False,AxesOrigin->{2,-2,-1},PlotRange->{{-2,2},{-2,2},{-1,1}},PlotLabel->Style[StringForm["Horizontal planes z=``, z=``, and z=``",-1,0,1],FontSize->22],ViewPoint->{1,.2,.4}]

(*Change the equation to change the plane.*)
thePlane1[x_,y_]:=1-x-y;

thePlanePlot = Plot3D[thePlane1[x,y],{x,-2,2},{y,-2,2},PlotStyle->{Green,Opacity[0.2]}];
Show[Graphics3D[{Text["x",{2.1,0,0}],Text["y",{0,2.1,0}],Text["z",{0,0,5.2}]}],thePlanePlot,Axes->True,Boxed->False,PlotRange->{{-2,2},{-2,2},{-5,5}},AxesOrigin->{0,0,0},
PlotLabel->Style[Row[{"The plane ",z==thePlane[x,y]}],FontSize->24],ViewPoint->{5,1,2},BoxRatios->{2,2,3}]

(*Change the equation to change the plane.
Note that the graphic cuts off outside the cube 0 ≤ x,y,z ≤ 3, so parts of the picture (especially the normal vectors) may be cut off if the plane is changed*)
thePlane[x_,y_]:=1-x-y

(*Compute the intersection of the plane with each axis, as well as a midpoint.  These will serve as base points for our normal vectors.*)
xPoint = {xSol,0,0}/.First[Solve[thePlane[xSol,0]==0]];
yPoint = {0,ySol,0}/.First[Solve[thePlane[0,ySol]==0]];
zPoint = {0,0,zSol}/.First[Solve[thePlane[0,0]==zSol]];
midPoint = (xPoint+yPoint+zPoint)/3;

(*Above, we defined the plane in the form z=f(x,y).  f(1,0)-f(0,0) would give the coefficient on x in f(x,y), and likewise f(0,0)-f(0,1) gives the coefficient on y.  If we imagine moving the x and y terms over to the same side as z in order to write the plane in standard form, we see that the normal vector we get is (f(0,0)-f(1,0), f(0,0)-f(0,1), 1).*)
n1={thePlane[0,0]-thePlane[1,0],thePlane[0,0]-thePlane[0,1],1};

plane = Plot3D[thePlane[x,y],{x,0,2},{y,0,2},PlotStyle->{Green,Opacity[0.2]}];
yzBoundary = {Blue,Thickness[0.008],Line[{yPoint,zPoint}]};
xzBoundary = {Blue,Thickness[0.008],Line[{xPoint,zPoint}]};
xyBoundary = {Blue,Thickness[0.008],Line[{xPoint,yPoint}]};
planeFrame = Show[Graphics3D[{yzBoundary,xzBoundary,xyBoundary,Text["x",{3.1,0,0}],Text["y",{0,3.1,0}],Text["z",{0,0,3.1}]}],plane,Axes->True,Boxed->False,PlotRange->{{0,3},{0,3},{0,3}},AxesOrigin->{0,0,0},
PlotLabel->Style[StringForm["The plane z=`` in the first octant",thePlane[x,y]],FontSize->16],ViewPoint->{2000,400,800}];

normal1 = {Red,Thickness[0.008],Arrow[{xPoint,xPoint+n1}]};
normal2 = {Red,Thickness[0.008],Arrow[{yPoint,yPoint+n1}]};
normal3 = {Red,Thickness[0.008],Arrow[{zPoint,zPoint+n1}]};
normal4 = {Red,Thickness[0.008],Arrow[{midPoint,midPoint+n1}]};
normalFrame = Show[Graphics3D[{yzBoundary,xzBoundary,xyBoundary,normal1,normal2,normal3,normal4,Text["x",{3.1,0,0}],Text["y",{0,3.1,0}],Text["z",{0,0,3.1}]}],plane,Axes->True,Boxed->False,PlotRange->{{0,3},{0,3},{0,3}},AxesOrigin->{0,0,0},
PlotLabel->Style[StringForm["The plane z=`` and some of its normals",thePlane[x,y]],FontSize->16],ViewPoint->{2000,400,800}];

planeFrames = {planeFrame,normalFrame};
Animate[planeFrames[[t]],{t,1,2,1}]

(*Change the point and the normal to change the plane*)
P = {0,0,2};
n = {1,2,3};

(*The following function's level set at 0 is the desired plane.*)
function[x_,y_,z_]:=n.({x,y,z}-P);

(*Math done; the rest is graphics formatting.*)
point = {Blue,PointSize[0.02],Point[P]};
normal = {Red,Thickness[0.008],Arrow[{P,P+n}]};
planePlot = ContourPlot3D[function[x,y,z]==0,{x,-2,2},{y,-2,2},{z,-5,5},ContourStyle->{Green,Opacity[0.2]}];

planeFrame2[graphics_,plots_,title_] := Show@@Join[plots,{Graphics3D[Join[graphics,{Text["x",{3.1,0,0}],Text["y",{0,3.1,0}],Text["z",{0,0,5.2}]}]],Axes->True,Boxed->False,PlotRange->{{-3,3},{-3,3},{-5,5}},AxesOrigin->{0,0,0},
PlotLabel->Style[title,FontSize->16],BoxRatios->{2,2,3},ViewPoint->{2000,400,800}}];pointFrame=planeFrame2[{point},{},"A plane can be defined by a point...\n"];
normalFrame=planeFrame2[{point,normal},{},"...and a normal vector.\n"];
normalplaneFrame=planeFrame2[{point,normal},{planePlot},StringForm@@Join[{"The plane through \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"P", "=", 
RowBox[{"(", 
RowBox[{"``", ",", "``", ",", "``"}], ")"}]}], TraditionalForm]]]]]\)\nwith normal \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"n", "=", 
RowBox[{"⟨", 
RowBox[{"``", ",", "``", ",", "``"}], "⟩"}]}], TraditionalForm]]]]]\)"},P,n]];

planeFrames2={pointFrame,normalFrame,normalplaneFrame};
Animate[planeFrames2[[t]],{t,1,3,1}]

(*Change the points to change the plane*)
P = {1,3,2};
Q = {3,-1,5};
R = {5,2,0};

(*Compute a normal vector.  To ensure that it's a reasonable size, we rescale it to have length 3.*)
n = N[3*Normalize[Cross[Q-P,R-P]]];

(*Now we can define a function whose level set at 0 gives the desired plane.*)
function[x_,y_,z_]:=n.({x,y,z}-P);

(*Math done; the rest is graphics formatting.*)
pointP = {Blue,PointSize[0.02],Point[P]};
pointQ = {Blue,PointSize[0.02],Point[Q]};
pointR = {Blue,PointSize[0.02],Point[R]};
labelP = Text["P",1.2*P];
labelQ = Text["Q",1.2*Q];
labelR = Text["R",1.2*R];

arrowPQ = {Thickness[0.005],Arrow[{P,Q}]};
arrowPR = {Thickness[0.005],Arrow[{P,R}]};

arrowN = {Red,Thickness[0.005],Arrow[{P,P+n}]};
labelN = Text["n",1.2*P+n];

plane = ContourPlot3D[function[x,y,z]==0,{x,-6,6},{y,-6,6},{z,-6,6},ContourStyle->{Green,Opacity[0.2]}];

frameFunction3[graphics_,plots_,title_] := Show@@Join[plots,{Graphics3D[Join[graphics,{pointP,pointQ,pointR,Text["x",{6.2,0,0}],Text["y",{0,6.2,0}],Text["z",{0,0,6.2}]}]],Axes->True,Boxed->False,PlotRange->{{-6,6},{-6,6},{-6,6}},AxesOrigin->{0,0,0},
PlotLabel->Style[title,FontSize->16],ViewPoint->{2000,400,800}}];pointFrame1=frameFunction3[{labelP,labelQ,labelR},{},"A plane is determined by three points\n"];pointFrame2=frameFunction3[{labelP,labelQ,labelR,arrowPQ,arrowPR},{},"Use the vectors PQ and PR...\n"];
pointFrame3=frameFunction3[{arrowPQ,arrowPR,arrowN,labelN},{},"...to find a normal vector n\n"];
pointFrame4=frameFunction3[{arrowPQ,arrowPR,arrowN,labelN},{plane},StringForm@@Join[{"The plane through\n \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"P", "=", 
RowBox[{"(", 
RowBox[{"``", ",", "``", ",", "``"}], ")"}]}], TraditionalForm]]]]]\), \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"Q", "=", 
RowBox[{"(", 
RowBox[{"``", ",", "``", ",", "``"}], ")"}]}], TraditionalForm]]]]]\), and \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"R", "=", 
RowBox[{"(", 
RowBox[{"``", ",", "``", ",", "``"}], ")"}]}], TraditionalForm]]]]]\)\n"},P,Q,R]];
pointFrames = {pointFrame1,pointFrame2,pointFrame3,pointFrame4};

Animate[pointFrames[[t]],{t,1,4,1}]

(*Change these to change the planes.  The first plane is of the form formula1=value1 (so x-2y+z=1 by default), and the second is formula2=value2 (so x-2y-2z=-1 by default).
Since we will be picking the intersection points based on y value, the animation will not work unless there is a unique intersection point for any given y value.*)
planeFormula1[x_,y_,z_]:=-2x+y+z;
value1 = 1;
planeFormula2[x_,y_,z_]:=2x+y-2z;
value2=-1;

(*Compute normal vectors*)
normalVector1 = {planeFormula1[1,0,0],planeFormula1[0,1,0],planeFormula1[0,0,1]};normalVector2 = {planeFormula2[1,0,0],planeFormula2[0,1,0],planeFormula2[0,0,1]};
(*The cross product of the normals is parallel to both planes, so it is the direction vector of their line of intersection*)
crossVector=Cross[normalVector1,normalVector2];

(*Rewrite the plane equations as z=f(x,y)*)
(*This is so that we can use Plot3D instead of ContourPlot3D later, as Plot3D's mesh looks better.*)
planeFormula1z[x_,y_]:=(zSol/.First[NSolve[planeFormula1[x,y,zSol]==value1]]);planeFormula2z[x_,y_]:=(zSol/.First[NSolve[planeFormula2[x,y,zSol]==value2]]);

(*Compute the base point: the intersection point where y=1*)
intersection0={x,1,z}/.First[NSolve[planeFormula1[x,1,z]==value1&&planeFormula2[x,1,z]==value2,{x,y,z}]];
(*We will draw our line from the intersection point at y=-5 to the intersection point at y=5*)
intersectionFirst={x,-5,z}/.First[NSolve[planeFormula1[x,-5,z]==value1&&planeFormula2[x,-5,z]==value2,{x,y,z}]];intersectionLast={x,5,z}/.First[NSolve[planeFormula1[x,5,z]==value1&&planeFormula2[x,5,z]==value2,{x,y,z}]];

(*Math done; the rest is graphics formatting*)
intersectionPoint={Blue,PointSize[0.03],Point[intersection0]};
intersectionLine = {Red,Thickness[0.01],Line[{intersectionFirst,intersectionLast}]};

normalArrow1 = {RGBColor[0,0.5,0],Thickness[0.008],Arrow[{intersection0,intersection0+normalVector1}]};normalArrow2 = {RGBColor[0.4,0,0.4],Thickness[0.008],Arrow[{intersection0,intersection0+normalVector2}]};
crossArrow = {Red,Thickness[0.008],Arrow[{intersection0,intersection0+crossVector}]};

planePlot1=Plot3D[planeFormula1z[x,y],{x,-5,5},{y,-5,5},Mesh->4,MeshStyle->{{Green,Thickness[0.005]},{Green,Thickness[0.005]}},BoundaryStyle->Green,PlotStyle->{LightGreen,Opacity[1]},Lighting->{{"Ambient",White}}];
planePlot1Faded=Plot3D[planeFormula1z[x,y],{x,-5,5},{y,-5,5},Mesh->4,MeshStyle->Green,BoundaryStyle->Green,PlotStyle->{LightGreen,Opacity[0.2]},Lighting->{{"Ambient",White}}];planePlot2=Plot3D[planeFormula2z[x,y],{x,-5,5},{y,-5,5},Mesh->4,MeshStyle->{{Purple,Thickness[0.005]},{Purple,Thickness[0.005]}},BoundaryStyle->Purple,PlotStyle->{LightPurple,Opacity[1]},Lighting->{{"Ambient",White}}];planePlot2Faded=Plot3D[planeFormula2z[x,y],{x,-5,5},{y,-5,5},Mesh->4,MeshStyle->Purple,PlotStyle->{LightPurple,Opacity[0.2]},BoundaryStyle->Purple,Lighting->{{"Ambient",White}}];

frameFunction4[graphics_,plots_,title_] := Show@@Join[plots,{Graphics3D[Join[graphics,{Text["x",{11,0,0}],Text["y",{0,11,0}],Text["z",{0,0,511}]}]],Axes->True,Boxed->False,PlotRange->{{-10,10},{-10,10},{-10,10}},AxesOrigin->{0,0,0},
PlotLabel->Style[title,FontSize->16],ViewPoint->{2000,400,800},BoxRatios->{1,1,1}}];

intersectionFrame1=frameFunction4[{intersectionPoint,intersectionLine},{planePlot1,planePlot2},StringForm["Intersection of\n `` = `` and `` = ``",ToString[planeFormula1[x,y,z]],value1,ToString[planeFormula2[x,y,z]],value2]];
intersectionFrame2=frameFunction4[{intersectionPoint},{planePlot1Faded,planePlot2Faded},StringForm@@Join[{"Point \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"P", " ", "=", " ", 
RowBox[{"(", 
RowBox[{"``", ",", " ", "``", ",", " ", "``"}], ")"}]}], TraditionalForm]]]]]\) is common to both planes\n"},Map[Function[x,StringReplace[ToString[x],RegularExpression["\\.$"]->""]],intersection0]]];intersectionFrame3=frameFunction4[{intersectionPoint,normalArrow1},{planePlot1Faded,planePlot2Faded},StringForm@@Join[{"Vector \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"m", " ", "=", " ", 
RowBox[{"(", 
RowBox[{"``", ",", " ", "``", ",", " ", "``"}], ")"}]}], TraditionalForm]]]]]\) is normal to `` = ``\n"},Map[ToString,normalVector1],{ToString[planeFormula1[x,y,z]],ToString[value1]}]];
intersectionFrame4=frameFunction4[{intersectionPoint,normalArrow1,normalArrow2},{planePlot1Faded,planePlot2Faded},StringForm@@Join[{"Vector \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"n", " ", "=", " ", 
RowBox[{"(", 
RowBox[{"``", ",", " ", "``", ",", " ", "``"}], ")"}]}], TraditionalForm]]]]]\) is normal to `` = ``\n"},Map[ToString,normalVector2],{ToString[planeFormula2[x,y,z]],ToString[value2]}]];intersectionFrame5=frameFunction4[{intersectionPoint,normalArrow1,normalArrow2,crossArrow},{planePlot1Faded,planePlot2Faded},StringForm@@Join[{"The cross product of m and n is \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"v", " ", "=", " ", 
RowBox[{"⟨", 
RowBox[{"``", ",", " ", "``", ",", " ", "``"}], "⟩"}]}], TraditionalForm]]]]]\)\n"},Map[ToString,crossVector]]];intersectionFrame6=frameFunction4[{intersectionPoint,normalArrow1,normalArrow2,crossArrow,intersectionLine},{planePlot1Faded,planePlot2Faded},StringForm@@Join[{"The intersection is the line through\n \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"P", " ", "=", " ", 
RowBox[{"(", 
RowBox[{"``", ",", " ", "``", ",", " ", "``"}], ")"}]}], TraditionalForm]]]]]\) with direction vector \!\(\*Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"v", "=", 
RowBox[{"⟨", 
RowBox[{"``", ",", " ", "``", ",", " ", "``"}], "⟩"}]}], TraditionalForm]]]]]\)"},Map[ToString,Join[intersection0,crossVector]]]];

intersectionFrames5 = {intersectionFrame1,intersectionFrame2,intersectionFrame3,intersectionFrame4,intersectionFrame5,intersectionFrame6};
Animate[intersectionFrames5[[t]],{t,1,6,1},DefaultDuration->10]