# Simplify graphics [duplicate]

I want to simplify my complicated code write neat and systematic code. I use animate after solving differential equations. It's my Phd code and is very heavy and complicated. I want to simplify my graphics. It consists of a lot of lines a lot of Disk and ... . I want to know that can I define contents of graphics before it.

s = NDSolve[{D[D[L, θ1'[t]], t] - D[L, θ1[t]] +
D[RDF, θ1'[t]] == 0, θ1[0] ==
Pi/6, θ1'[0] == 0}, {θ1}, {t, 50},];

Animate[Graphics[{Line[{θ1,
2 θ1}, {3 θ1, θ1}], Line[{}, {}], ...,
Disk[{θ1, 2 θ1}, {3 θ1, θ1}], ...,
Rectangle[{, }, {, }]}], {t, 1, 50}] /. s


for example Like that

 s = NDSolve[{D[D[L, θ1'[t]], t] - D[L, θ1[t]] +
D[RDF, θ1'[t]] == 0, θ1[0] ==
Pi/6, θ1'[0] == 0}, {θ1}, {t, 50},];

Line1= Line[{θ1, 2 θ1}, {3 θ1, θ1}]
Line2=...
Disk1=Line[{θ1, 2 θ1}, {3 θ1, θ1}]
Disk2=...

Animate[Graphics[{Line1, Line2, ...,], {t, 1, 50}] /. s


I have not any answer and after received an idea I can Edit my question with a real and simple example that help other users.

• hi, it is not clear what is the question here. Can you please clarify what is it you are asking? Jan 10, 2017 at 9:27
• I want define line, disk, rectangle and... before or out of graphics function for more neat code. if I use 54 lines, 15 disk, and a lot of shapes it become very unteady and it can make problem in editing and readability of my code. Jan 10, 2017 at 9:55

I think probably this question is a duplicate of How are parameters evaluated for a Plot in Manipulate.

A simple example of what I think you are attempting:

line = Line[{{t, 3}, {4, 5 - t}}]

Animate[Graphics[line[t]], {t, 1, 10}]  (* failure *)


A solution from the Accepted answer to the referenced Question:

ClearAll[line]

line[t_] := Line[{{t, 3}, {4, 5 - t}}]

Animate[Graphics[line[t]], {t, 1, 10}]