If this is for use in Beamer, the easiest way to do this is not to make the background transparent but to use Beamer's colours to ensure a match with the background. Since the background in your example is white, I've also changed the text colour to match the foreground colour since white text on a white background is not very easy to read unless your eyes are much keener than mine.
\documentclass[serif]{beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.text,arrows}% Note that arrows is deprecated
\begin{document}
\begin{frame}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.6cm,y=0.6cm, draw=red]
\clip(-6,-6) rectangle(6.1,6.1);
\draw[solid,->,color=red](-5,0)--(6,0);
\draw[solid,->,color=red](0,-5)--(0,6);
\draw (-5,-5) .. controls (5,-5) and (5,-5) .. (5,5);
\draw [decorate,decoration={text effects along path,text={Function {$f$}{$($}{$x$}{$)$}{$=$}{$2$}{$x$}{$^3$}}, text align=center,text effects/.cd, text along path, every character/.style={color=fg, fill=bg, yshift=-0.5ex}}](-5,-5) .. controls (5,-5) and (5,-5) .. (5,5);
\end{tikzpicture}
\end{frame}
\end{document}
If we now load a radically different colour theme, such as albatross
, we get a quite different result:
\documentclass[serif]{beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.text,arrows}% Note that arrows is deprecated
\usecolortheme{albatross}
\begin{document}
\begin{frame}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.6cm,y=0.6cm, draw=red]
\clip(-6,-6) rectangle(6.1,6.1);
\draw[solid,->,color=red](-5,0)--(6,0);
\draw[solid,->,color=red](0,-5)--(0,6);
\draw (-5,-5) .. controls (5,-5) and (5,-5) .. (5,5);
\draw [decorate,decoration={text effects along path,text={Function {$f$}{$($}{$x$}{$)$}{$=$}{$2$}{$x$}{$^3$}}, text align=center,text effects/.cd, text along path, every character/.style={color=fg, fill=bg, yshift=-0.5ex}}](-5,-5) .. controls (5,-5) and (5,-5) .. (5,5);
\end{tikzpicture}
\end{frame}
\end{document}
Note that it is extremely important, when using Beamer, to avoid changing the colours of Beamer elements in the usual way. \color{red}
or \pagecolor{black}
will cause all kinds of complications by preventing Beamer from tracking colours correctly.
This is because Beamer fakes transparency by keeping track of the background colour. So if you use an overlay effect which renders content partially transparent, for example, Beamer doesn't really use partial transparency. Instead, it mixes the foreground colour with the background colour in order to simulate partial transparency. In order for this to work, it is vital that Beamer's colours not be overridden using non-Beamer colour macros. To change the background colour, use the appropriate Beamer command. Similarly for text etc.
In this case, use draw=red
as an argument for the tikzpicture
if you just want the effect in the picture. Otherwise, if all text etc. should be red, change the appropriate Beamer colour to red.
For details of how this system works and how to use it, see the Beamer manual's discussion in section 17, 'Colors'.
EDIT
If you are rasterising images and need transparency for posting on the web, then the above method may not work.
Here's a method which uses a fading to achieve a transparent result.
\documentclass[serif]{beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.text,arrows,fadings}% Note that arrows is deprecated
\usebackgroundtemplate{}
\begin{tikzfadingfrompicture}[line cap=round,line join=round,>=triangle 45,x=0.6cm,y=0.6cm, name=my fading]
\draw [draw=transparent!0, postaction={decorate, decoration={text effects along path, text={Function {$f$}{$($}{$x$}{$)$}{$=$}{$2$}{$x$}{$^3$}}, text align=center, text effects/.cd, text along path, every character/.style={color=transparent, fill=transparent}}}](-5,-5) .. controls (5,-5) and (5,-5) .. (5,5);
\end{tikzfadingfrompicture}
\begin{document}
\begin{frame}
\begin{tikzpicture}[line cap=round, line join=round, >=triangle 45, x=0.6cm, y=0.6cm, draw=red]
\clip(-6,-6) rectangle (6.1,6.1);
\draw [solid,->, color=red](-5,0)--(6,0);
\draw [solid,->, color=red](0,-5)--(0,6);
\draw [decorate, decoration={text effects along path, text={Function {$f$}{$($}{$x$}{$)$}{$=$}{$2$}{$x$}{$^3$}}, text align=center, text effects/.cd, text along path, every character/.style={color=fg, yshift=-0.5ex}}](-5,-5) .. controls (5,-5) and (5,-5) .. (5,5);
\fill [red, path fading=my fading, fit fading=false] (-5,-5) rectangle (5,5);
\end{tikzpicture}
\end{frame}
\end{document}