This macro is similar to <<timedreplace>>
, but instead of replacing one block of text with another, it just redraws a block of text, running the code again.
http://www.glorioustrainwrecks.com/files/TwineMacro-TimedLoop.txt
Much like <<timedreplace>>
, the transition between each rewrite is handled by CSS. Here's a default "fade-in" transition:
.replacement-in { opacity: 0; } .timedloop { transition: 1s; -webkit-transition: 1s; } .replacement-out { display:none; }
<<timedreplace>>
's CSS, so you may omit them if you're also using <<timedreplace>>
.)
Here's a usage example:
<<set $red=1>> <<timedloop 2>>You have <<set $red += 1>><<print $red>> seed pods.<<endtimedloop>>will start with "You have 2 seed pods.", then change to "You have 3 seed pods." after 1 second, then "You have 4 seed pods." after another second, and so forth. The time value is in half-seconds, like
<<timedreplace>>
.
Implementation details:
* If inserted text appears and descends below the bottom of the screen, the page should automatically scroll down to make it visible.
* Note: due to the way the browser and Twine interact, any changes made by code inside a <<timedloop>>
tag after the first iteration will be forgotten if you use the Back or Forward browser buttons. This means that if you put long-term variable changes that affect future passages inside one, you should disable the Back button.
Version history:
* 5-4-2013: Initial
Attachment | Size |
---|---|
TwineMacro-TimedLoop.txt | 2.96 KB |