Skip to Content
Learn Red ? Fundamentals of Red
book

Learn Red ? Fundamentals of Red

by Ivo Balbaert
May 2018
Beginner content levelBeginner
252 pages
6h 19m
English
Packt Publishing
Content preview from Learn Red ? Fundamentals of Red

Timer event

For this kind of event, there is an on-time actor. This actor works together with the face's rate facet, which sets the rate at which the event takes place, either expressed in:

  • Rate per second, such as one time per second: rate 1, so rate 50 is 50 times faster than rate 1
  • As a time! value, such as rate 0:00:03 for every 3 seconds

At each tick, the on-time actor is executed. Here are a few simple examples. Note how we can achieve some primitive animation effects by changing the offset in an on-time actor:

;-- see Chapter09/timers.red:view [    size 400x400    b: button 80x30 green "Catch me" rate 50         on-time [b/offset: b/offset + 1x1]        on-down [quit]    t1: text txt rate 5        on-time [either t1/text = "" [t1/text: txt][t1/text: ""]] t2: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

How I Built a Personal Board of Directors With GenAI

How I Built a Personal Board of Directors With GenAI

Vipin Gupta
How to Become a Game-Changing Leader

How to Become a Game-Changing Leader

Douglas A. Ready, Alan Mulally
Why AI Demands a New Breed of Leaders

Why AI Demands a New Breed of Leaders

Faisal Hoque, Thomas Davenport, Erik Nelson

Publisher Resources

ISBN: 9781789130706Supplemental Content