+2 votes
by (630 points)

Is there any way to use the (transition:) macro in conjunction with (replace:) or (show:) so that the result is less jarring?

When a hook appears using these macros, it pops into existence.  Is it possible to transition with a dissolve?  Or is that only possible when using (link:)?

Here is some example code.  The (link:) has a (transition:) that fades in the replacement text, but the hook that appears from (show:) pops on, and the hook that disappears with (replace:) pops off:

He encourages you to insert a token into the machine.  
You \
	|token>[(link: "insert the token")[\
			  (replace: ?or)[]\
			  (replace: ?afraid)[]\
			  (transition: "dissolve")
			  [press the token to your temple.]\
			  (show: ?tokenResult)\
			  ]\
		]\
	|or>[// or //]\
	|afraid>[\
		(link: "are too afraid to play.")[\
			(replace: ?token)[]\
			(replace: ?or)[]\
			(transition: "dissolve")\
			[are too afraid to play.]\
			(show: ?afraidResult)\
			]\
		]\


|tokenResult)[\
		The machine comes to life.  Time to play.
	]\
|afraidResult)[\
		You run away.  The last game was too humiliating.
	]

I'm on Twine 2.1.3.  Mac OS Sierra.  Harlowe 2.0.1

 

1 Answer

+1 vote
by (63.1k points)

First, thank you for indenting and spacing your code so well!

I think you just need to put the transition everywhere, though there may be an easier way.  In the following example, I set the variable $t to the desired transition to make things simpler/cleaner:

(set: $t to (t8n: 'dissolve'))\
He encourages you to insert a token into the machine.  
You \
    |token>[\
        (link: "insert the token")[\
            (replace: ?or)[$t[]]\
            (replace: ?afraid)[$t[]]\
            $t[press the token to your temple.]\
            (show: ?tokenResult)\
        ]\
    ]\
    |or>[// or //]\
    |afraid>[\
        (link: "are too afraid to play.")[\
            (replace: ?token)[$t[]]\
            (replace: ?or)[$t[]]\
            $t[are too afraid to play.]\
            (show: ?afraidResult)\
        ]\
    ]\


|tokenResult)[$t[\
        The machine comes to life.  Time to play.
    ]]\
|afraidResult)[$t[\
        You run away.  The last game was too humiliating.
    ]]

 

by (630 points)
Thanks for the reply Chapel.  Still getting the hang of formatting code, glad it was legible!

Works like a charm!  Though it does take a lot more code than I'd hoped, since I'll be doing this a lot!

I'm not very experienced with CSS Styling, but is there a solution in the stylesheet that could make all hooks fade on with dissolve?
by (63.1k points)
Probably. I messed around with some CSS and jQuery and couldn't find a reliable way, though. Someone else might be able to come up with something. I'll let you know if I think of anything in the mean time.
...