« View all new features in
Mathematica
9
◄
previous
|
next
►
New in
Mathematica
9
›
Gauges
Driving Game
In[1]:=
X
Graphics[{Dynamic[{Darker[Green, .5], Rectangle[{-3, -2}, Dynamic[{3, -(2/(1 + 10 horizon))}]], GrayLevel[.5], Thick, EdgeForm[GrayLevel[.45]], Dynamic[Polygon[({#1[[1, 1]], #1[[1, 2]], #1[[2, 2]], #1[[2, 1]], #1[[1, 1]]} &) /@ Partition[road, 2, 1]]], EdgeForm[], Texture[ImageData[tree]], Dynamic[trees]}], Inset[AngularGauge[Dynamic[Fuel], {0, 100}, ImageSize -> Automatic, fuelopts], {-1.2, -1.75}, {0, 0}, {1, 1}/2], Inset[AngularGauge[Dynamic[MPH], {0, 140}, ImageSize -> Automatic, spmopts], {-(1/2), -1.5}, {0, 0}, {1, 1}], Inset[AngularGauge[Dynamic[RPMs], {0, 8}, ImageSize -> Automatic, tachopts], {1/2, -1.5}, {0, 0}, {1, 1}], Inset[AngularGauge[Dynamic[OilTemperature], {100, 250}, ImageSize -> Automatic, tempopts], {1.2, -1.75}, {0, 0}, {1, 1}/ 2]}, ImageSize -> 600, ImagePadding -> None, PlotRangePadding -> None, PlotRange -> {{-2, 2}, {-2, 1}}, Background -> Lighter[Blue, .5]]
Create a driving simulation with a speedometer, tachometer, and fuel and oil pressure gauges.
Play Animation
»
Stop Animation
»