Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sounds+Appearing Text

Hello!
Today I downloaded Twine 2.0! I watched few tutorials and got the basics...
However, I still need help!

1. How can I add sounds which will play in background of specified story-page?
I have tried with <audio src="blahbla/music.mp3" autoplay> but it doesnt work...


2. Is there any "already made" script to create somenthing like fade-in text?
I want text to smoothly appear automatically after few seconds...


Can anyone help me?

Comments

  • Format, please. The answers are different depending on which story format you are using.

    Rest assured that it HAS been done. And CAN be done again. You can also search the forum for examples or we can help you....

    But we need certain info first.

    Good luck.
  • edited July 2015
    Harlowe 1.1.1
  • edited July 2015
    By the way:
    I want to include music which will play ONLY in background of ONE, single passage (different music for every location)
    And also music (single, wav sound) which will play while clicking on hook :d
  • edited July 2015
    Well, Im doing a little mess here but Im still browsing net and looking for answers.

    Assuming now, I need only answers answers for questions below:

    I see that <audio src="URL" autoplay> works and music stops after passage.
    How to make the music continue?

    How to make music play after pressing text, created with (click: cl1) ?
    (click: cl1)<audio src="URL"> doesn't work urfotunately :\

    Is there any javascript script for text fade-in?
  • edited July 2015
    SugarCube handles music better than Harlowe, and Twine 1.4 gives more options for fade-in text due to its support for internalising JavaScript libraries. If you've only just started using Twine (so have not invested significantly in any story format), I recommend you look at the pros and cons of different story formats.

    If you're going to do a lot of music work (which it sounds like), you're far better off with SugarCube. Doing complex music playlists with Harlowe is like trying to bash a bowling ball into a golf hole.

    Nevertheless, in Harlowe you should still be able to attach css animation to a span element. I cannot give you specific advice for Harlowe but the basics are the following css declarations:
    .fade {
    animation: fadeIn 1000ms 1 forwards;
    -webkit-animation: fadeIn 1000ms 1 forwards;
    transition: none;
    webkit-transition: none;
    }
    
    @-webkit-keyframes fadeIn {
      0% {
    	opacity: 0;
    	-webkit-transform: translate3D (0,0,0);
      }
    
      100% {
    	opacity: 1;
    	-webkit-transform: translate3D (0,0,0);
      }
    }
    
    @keyframes fadeIn {
      0% {
    	opacity: 0;
    	transform: translate3D (0,0,0);
      }
    
      100% {
    	opacity: 1;
    	transform: translate3D (0,0,0);
      }
    }
    

    That you attach to your text with a <span class="fade">Faded text</span>. When it appears on screen, the words "Faded text" will fade in over 1 second.

    If you want the whole story doing this, or specific passages, then you'll need to alter the code to access Harlowe's passage elements, which I don't know since am not a Harlowe user.

    Anything ridiculously complex (like different layers fading in and out at the same time) you're best off employing GreenSock in Twine 1.4, though.
  • As explained in this comment Harlowe uses a dissolve CSS based transition between passage texts, that comment also contains the CSS selectors involved in both side of the transition.
  • Yey! Worked!

    Thanks! I will be using Sugar Cube then propably...
    What about sounds then? :d
  • Read the SugarCube documentation for its audio macros.
  • Okey. Checked. However still have problem with one thing.
    I want to use
    <<click>>
    
    . Person, after clicking specified link, will see appearing text and hear audio.
    Audio plays but there is no text. I've done somenthing like this:
    <<click "Press" "Done!">><<audio "Russia" play>> <</click>>.
    
    However, the text in second " " is taken as a passage which should be launched...
    Command
    <<print>>
    
    doesnt work there too...
    How to create just appearing text?

    (Like:
    [Press]<pres|.
    
    (click: ?pres)[Done]
    

    in Harlowe)
  • If you're going to use SugarCube, I'd suggest using 2.0 if you can (see: SugarCube 2.x in Twine 2 for install instructions).

    As noted by Claretta, the audio macro documentation (for SugarCube 2.x or for SugarCube 1.x) has the basics of what you need, though I'm sure you'll have questions.
  • edited July 2015
    Nah, enough of changes :P
    At least for this project - maybe later.

    I just wanna know how to set displaying text after clicking on link and that's all what I need for this one... :d
  • Use SugarCube's <<replace>> macro (1.x), the documentation of 2.x even includes a <<click>> based example.

    The following is based on your previous example.
    <<click "Press">>
    	<<replace "#output">>Text to display after click<</replace>>
    	<<audio "Russia" play>>
    <</click>>
    <span id="output"></span>
    
  • Replace!
    Sneaky!

    Thanks!
    Thats all I need!
Sign In or Register to comment.