0 votes
by (120 points)
Hello,

 

I'm kinda new with Twine and I had a little feature in mind that would be a great feature in my story. Is it possible to have a javascript code to make each line of text slowly fade in after a second or two.

For example:

Line one

line two

line three

 

I'd like to implement this, so that the player won't be bombed with much text upon reading.

I'm not much of a proffesional with javascript. I only know basic HTML/CSS.

 

Thank you :)

2 Answers

+1 vote
by (1.7k points)

For Twine 1 or 2? Sugarcube / Harlowe / other?

If Sugarcube 2 (in either version of Twine), you can use this little guy made by Chapel or, more simply, the timed macro that's built into Sugarcube. I haven't used Harlowe, but from a quick search, it looks a little trickier but still easily doable.

0 votes
by (360 points)

If you do it with harlowe, you can use the (live:[reload time]) macro. I'm bad at explaining, but here's a code exampfe of which I hope it'll help:

(live:1s)[
(set: $helloTimer to $helloTimer + 1)
(if: $helloTimer is 3 or $helloTimer > 3)[Line 1]
(if: $helloTimer is 6 or $helloTimer > 6)[Line 2]
(if: $helloTimer is 9 or $helloTimer > 9)[Line 3]
(if: $helloTimer is 21)[(stop:)]]]}

THat probably isn't the most elegant way to answer it, but it worked for me.

It doesn't fade though, it just appears.

...