Advertisement
Matthen

Simultaneity

Jul 12th, 2011
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. light[t_, p_, s_] := p + t {s, 1};
  2. eye = Import[
  3. "http://a2.twimg.com/profile_images/1124979238/Eye_RGB__1__\
  4. reasonably_small.jpg"];
  5. spark = Import["http://cdn3.staztic.com/logos/spark-10.png"];
  6. frame[t_] :=
  7. Show[
  8. Graphics[{
  9. Line[{{0, t}, {2, t}}],
  10. PointSize[Medium],
  11. Point[{{0, t}, {2, t}}],
  12. Red, Rectangle[{0.9, t - 0.1}, {1.1, t + 0.1}],
  13. Inset[eye, {4, t}, {Right, Center}, 0.5],
  14. Green,
  15. If[Abs[t - 2.5] < 0.1,
  16. Disk[{3.5, 2.5}, 0.1],
  17. Opacity[1]
  18. ],
  19. If[Abs[t - 4.5] < 0.1,
  20. Disk[{3.5, 4.5}, 0.1],
  21. Opacity[1]
  22. ],
  23. If[Abs[t - 1] < 0.1,
  24. {Inset[spark, {0, 1}, {Center, Center}, 0.5],
  25. Inset[spark, {2, 1}, {Center, Center}, 0.5]},
  26. Opacity[1]
  27. ]
  28. }, PlotRange -> {{-1, 4}, {-0.1, 6.1}}],
  29. ParametricPlot[{light[Min[T, 1], {1, 0}, 1],
  30. light[Min[T, 1], {1, 0}, -1]}, {T, -10^-3, t},
  31. PlotStyle -> Directive[Thick, Darker@Yellow]],
  32. If[t > 1,
  33. ParametricPlot[{light[Min[T - 1, 1.5], {2, 1}, 1],
  34. light[Min[T - 1, 3.5], {0, 1}, 1], light[T - 1, {2, 1}, -1],
  35. light[T - 1, {0, 1}, -1]}, {T, 1 - 10^-3, t},
  36. PlotStyle -> Directive[Thick, Darker@Blue]]
  37. , Graphics[]
  38. ]
  39. ];
  40. Manipulate[frame[t], {t, 0, 5}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement