Message Boards Message Boards

0
|
3327 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Where is the function MinuteTimer[ ] ?

Posted 11 years ago

Dear All In a number of Wolfram video's the function MinuteTimer[ ] are used. Why can't find this in my Mathematica version 9.0.1.0.? This function is very usefull for time limited presentation.

See video: 'Build an App in 60 seconds' (started after 38 sec.) http://www.wolfram.com/broadcast/search.php?Search=app%20in%2060%20seconds&x=0&y=0&video=827

Thanks. JosK

POSTED BY: Jos Klaps
3 Replies

Dear Josk,

I don't think that MinuteTimer is a built in function. But perhaps this function might help:

MinuteTimer[] := 
Module[{}, d = 0; t = 0; t = AbsoluteTime[]; RunScheduledTask[d = AbsoluteTime[], {0.1, 600}]; 
Dynamic[If[(d - t) < 60, PieChart[{60 - (d - t), d - t}, SectorOrigin -> Pi/2., ChartStyle -> {White, Green}], 
PieChart[{1, 0}, ChartStyle -> {Red, White}]]]]

You can call it with

MinuteTimer[]

It is quite obvious how to change it to any other time. This is a generalised Timer function:

Timer[seconds_Integer] := Module[{}, d = 0; t = 0; t = AbsoluteTime[]; 
RunScheduledTask[d = AbsoluteTime[], {0.1, 10*seconds}]; Dynamic[If[(d - t) < seconds, 
PieChart[{seconds - (d - t), d - t}, SectorOrigin -> Pi/2., ChartStyle -> {White, Green}], 
PieChart[{1, 0}, ChartStyle -> {Red, White}]]]]

You can call it with any number of seconds (needs to be integers!):

Timer[8]

enter image description here

Cheers, M.

POSTED BY: Marco Thiel

Sorry, I just wanted to add that in the video they probably did not use the PieChart function but the common Disk function. In that case the function looks like this (I also deleted the initialisations for t and d):

Timer[seconds_Integer] := Module[{}, t = AbsoluteTime[]; RunScheduledTask[d = AbsoluteTime[], {0.1, 10*seconds}]; 
  Dynamic[If[(d - t) < seconds, Graphics[{Green, Disk[{0, 0}, 1, {Pi/2., Pi/2. - 2. Pi*(d - t)/(seconds)}]}, PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}}], 
  Graphics[{Red, Disk[{0, 0}, 1]}, PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}}]]]]

The general idea is the same as before. The animation looks a bit different because it has the black border lines removed.

enter image description here

Cheers, Marco

POSTED BY: Marco Thiel

Hi Marco,

Many thanks for your help. This is what I 'm looking for.

JosK

POSTED BY: Jos Klaps
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract