Using the absolute value function together with the floor function, you can write
$$
f(x)=1-\left|x-\left(2\left\lfloor\frac{x+1}{2}\right\rfloor\right)\right|
$$
Verification:
With $f$ as defined above, we get
\begin{align*}
f(x+2)
&=
1-\left|(x+2)-\left(2\left\lfloor\frac{(x+2)+1}{2}\right\rfloor\right)\right|
\\[4pt]
&=
1-\left|x+2-\left(2\left\lfloor\frac{x+1}{2}+1\right\rfloor\right)\right|
\\[4pt]
&=
1-\left|x+2-\left(2\left(\left\lfloor\frac{x+1}{2}\right\rfloor+1\right)\right)\right|
\\[4pt]
&=
1-\left|x+2-\left(2\left(\left\lfloor\frac{x+1}{2}\right\rfloor+1\right)\right)\right|
\\[4pt]
&=
1-\left|x+2-\left(2\left(\left\lfloor\frac{x+1}{2}\right\rfloor+1\right)\right)\right|
\\[4pt]
&=
1-\left|x+2-\left(2\left\lfloor\frac{x+1}{2}\right\rfloor\right)-2\right|
\\[4pt]
&=
1-\left|x-\left(2\left\lfloor\frac{x+1}{2}\right\rfloor\right)\right|
\\[4pt]
&=
f(x)
\\[4pt]
\end{align*}
so $f$ is periodic with period $2$.
It remains to verify that $f$ works correctly on the interval $[-1,1)$.
Thus suppose $f$ is restricted to the interval $[-1,1)$.
\begin{align*}
\text{Then}\;\;&
-1\le x < 1
\\[4pt]
\implies\;&
0\le x+1 < 2
\\[4pt]
\implies\;&
0\le \frac{x+1}{2} < 1
\\[4pt]
\implies\;&
\left\lfloor\frac{x+1}{2}\right\rfloor=0
\\[4pt]
\end{align*}
hence for $-1\le x < 1$ we get
$$
f(x)
=
1-\left|x-\left(2\left\lfloor\frac{x+1}{2}\right\rfloor\right)\right|
=
1-|x|
$$
which matches the graph for the interval $[-1,1)$.