I'm recently doing something related, so here is my more general but some how too expensive method. I'll take the curve defined by
$$x^4-2 x^2+y^4-2 y^2+\frac{99}{100}=0$$
for example.
First we define the function and plot the curve:
exprFunc[x_, y_] := x^4 + y^4 - 2 x^2 - 2 y^2 + 99/100
exprgraph =
ContourPlot[exprFunc[x, y] == 0, {x, -2, 2}, {y, -2, 2},
PlotRange -> {{-2, 2}, {-2, 2}}, AspectRatio -> Automatic]
Then we parametrize the curve with respect to natural parameter (i.e. the arc length $s$):
Fderiv = D[exprFunc[x, y], #] & /@ {x, y}
naturalderiv =
Reverse[{1, -1} Fderiv]/Sqrt[Fderiv.Fderiv] /. {x -> x[s], y -> y[s]}
(*find an initial point on the curve*)
xinit = x /. FindRoot[exprFunc[x, yinit = 0] == 0, {x, 2}]
1.04881
(*the natural parametric equation*)
naturalparaEq = With[{arcLength = 10},
NDSolve[{
x'[s] == naturalderiv[[1]],
y'[s] == naturalderiv[[2]],
x[0] == #[[1]], y[0] == #[[2]]
}, {x, y}, {s, 0, arcLength}][[1]] ]&@{xinit, yinit}
Now we can plot the tangent line any where and smoothly:
Manipulate[
Show[{exprgraph,
Graphics[{Black,
Circle[{x[s], y[s]} /. naturalparaEq /. s -> svalue, .04],
Lighter[Purple], Thickness[.005],
Line@
Table[{x[s], y[s]} + naturalderiv t /. naturalparaEq /.
s -> svalue,
{t, {-3, 3}}]
}]}],
{svalue, 0, 10}]
