Skip to main content
missing bracket
Source Link
VLC
  • 9.9k
  • 1
  • 32
  • 60
ClearAll[signal2b];
signal2b[dta_, duration_, color_][t_] := 
 Switch[dta[[-1]] <= t < dta[[-1]] + duration,  
   True, {Lighter[color, (t - dta[[-1]])/duration], 
         Disk[dta[[{3, 2}]], (1 - (t - dta[[-1]])/duration) dta[[5]]/ 10]}, 
   _, {}]; 
With[{tmin = AbsoluteTime[{2012, 3, 19, 23, 0}], 
      tmax = AbsoluteTime[{2012, 3, 20, 0, 0}]}, 
frames = Table[
 Graphics[{{White, Rectangle[{10, 43}, {13, 46}]}, 
   Text[Style[DateString[ t, {"Day", " ", "MonthNameShort", " ", "Year", " ", "Hour", 
     ":", "Minute"}], FontFamily -> "Helvetica", FontSize -> 20], {10.8, 45.85}], 
MapThread[{signal2b[#1, #2, #3][t]} &, {data, {3600, 2400, 
    600}, {Red, Green, Blue}}]}], {t, tmin, tmax, 60}]];
Export["fadingdisks2b.gif", frames, "DisplayDurations" -> .03]
ClearAll[signal2b];
signal2b[dta_, duration_, color_][t_] := 
 Switch[dta[[-1]] <= t < dta[[-1]] + duration,  
   True, {Lighter[color, (t - dta[[-1]])/duration], 
         Disk[dta[[{3, 2}]], (1 - (t - dta[[-1]])/duration) dta[[5]]/ 10]}, 
   _, {}]; 
With[{tmin = AbsoluteTime[{2012, 3, 19, 23, 0}], 
      tmax = AbsoluteTime[{2012, 3, 20, 0, 0}]}, 
frames = Table[
 Graphics[{{White, Rectangle[{10, 43}, {13, 46}]}, 
   Text[Style[DateString[ t, "Day", " ", "MonthNameShort", " ", "Year", " ", "Hour", 
     ":", "Minute"}], FontFamily -> "Helvetica", FontSize -> 20], {10.8, 45.85}], 
MapThread[{signal2b[#1, #2, #3][t]} &, {data, {3600, 2400, 
    600}, {Red, Green, Blue}}]}], {t, tmin, tmax, 60}]];
Export["fadingdisks2b.gif", frames, "DisplayDurations" -> .03]
ClearAll[signal2b];
signal2b[dta_, duration_, color_][t_] := 
 Switch[dta[[-1]] <= t < dta[[-1]] + duration,  
   True, {Lighter[color, (t - dta[[-1]])/duration], 
         Disk[dta[[{3, 2}]], (1 - (t - dta[[-1]])/duration) dta[[5]]/ 10]}, 
   _, {}]; 
With[{tmin = AbsoluteTime[{2012, 3, 19, 23, 0}], 
      tmax = AbsoluteTime[{2012, 3, 20, 0, 0}]}, 
frames = Table[
 Graphics[{{White, Rectangle[{10, 43}, {13, 46}]}, 
   Text[Style[DateString[ t, {"Day", " ", "MonthNameShort", " ", "Year", " ", "Hour", 
     ":", "Minute"}], FontFamily -> "Helvetica", FontSize -> 20], {10.8, 45.85}], 
MapThread[{signal2b[#1, #2, #3][t]} &, {data, {3600, 2400, 
    600}, {Red, Green, Blue}}]}], {t, tmin, tmax, 60}]];
Export["fadingdisks2b.gif", frames, "DisplayDurations" -> .03]
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

The following is a variation on Heike's answer allowing different colors and durations for different graphics objects:

ClearAll[signal1];
signal1[dta_, duration_, color_][t_] := 
 Piecewise[{{{Lighter[color, (t - dta[[-1]])/duration], Disk[dta[[{3, 2}]], dta[[5]]/10]},  dta[[-1]] <= t < dta[[-1]] + duration}, 
  {{},  t < dta[[-1]] || dta[[-1]] + duration <= t}}]; 
With[{tmin = AbsoluteTime[{2012, 3, 19, 23, 0}],  
      tmax = AbsoluteTime[{2012, 3, 20, 0, 0}]},
frames = Table[ Graphics[{{White, Rectangle[{10, 43}, {13, 46}]}, 
 Text[Style[ DateString[  t, {"Day", " ", "MonthNameShort", " ", "Year", " ", "Hour", 
     ":", "Minute"}], FontFamily -> "Helvetica", FontSize -> 20], {10.8, 45.85}], 
MapThread[{signal1[#1, #2, #3][t]} &, {data, {3600, 2400, 
    900}, {Red, Green, Blue}}]}], {t, tmin, tmax, 60}]];
Export["fadingdisks1.gif", frames, "DisplayDurations" -> .03]

enter image description here

Another variation that ties the disk radii to time:

ClearAll[signal2b];
signal2b[dta_, duration_, color_][t_] := 
 Switch[dta[[-1]] <= t < dta[[-1]] + duration,  
   True, {Lighter[color, (t - dta[[-1]])/duration], 
         Disk[dta[[{3, 2}]], (1 - (t - dta[[-1]])/duration) dta[[5]]/ 10]}, 
   _, {}]; 
With[{tmin = AbsoluteTime[{2012, 3, 19, 23, 0}], 
      tmax = AbsoluteTime[{2012, 3, 20, 0, 0}]}, 
frames = Table[
 Graphics[{{White, Rectangle[{10, 43}, {13, 46}]}, 
   Text[Style[DateString[ t, "Day", " ", "MonthNameShort", " ", "Year", " ", "Hour", 
     ":", "Minute"}], FontFamily -> "Helvetica", FontSize -> 20], {10.8, 45.85}], 
MapThread[{signal2b[#1, #2, #3][t]} &, {data, {3600, 2400, 
    600}, {Red, Green, Blue}}]}], {t, tmin, tmax, 60}]];
Export["fadingdisks2b.gif", frames, "DisplayDurations" -> .03]

enter image description here

Note: You can also use {color, Opacity[1 - (t - data[[-1]])/duration],...} instead of {Lighter[color, (t - data[[-1]])/duration},...} in definitions of signal1 and signal2b.