Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 1.26 KB

snowman_timedpassages.md

File metadata and controls

51 lines (34 loc) · 1.26 KB

"Timed Passages": Snowman (1.3.0)

Summary

Made famous in Queers in Love at the End of the World (2013), "Timed Passages" uses the the _.delay() function to count seconds while checking if the timer has reached zero. If so, the window.story.show() function will immediately transition to another passage.

Live Example

<iframe src="snowman_timedpassages_example.html" height=400 width=90%></iframe>

Download: Live Example

Twee Code

:: Start
There are <span class="time-left">10</span> seconds left.

<%
$(function() {
	var timeLeft = parseInt($('.time-left').text());
	
	function tick() {
		if (--timeLeft === 0) {
			story.show('World End');
		}
		else {
			$('.time-left').text(timeLeft);
		}
		
		_.delay(tick, 1000);
	}
	
	/* Start ticking. */
	
	_.delay(tick, 1000);
});
%>

:: World End
The world ended.

Download: Twee Code

See Also

Delayed Text, Typewriter Effect