Howdy, Stranger!

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

Change colour of cycling links & adding audio in Harlowe

Sorry for flooding the forum with questions.
I'm using Twine 2, Harlowe, and I'd like my cycling links to be a different colour than my regular links. I tried to model the code for this after the code for the colours of my other links/hovering links/etc, but since I am simply guessing, I'm not surprised nothing is happening. This is what I tried putting in my Story Stylesheet:
tw-link.class:cyclingLink {
color: #cc66ff)
font-weight: bold;
}

I also tried putting ' ' around cyclingLink, and using = in place of : after class. To no avail, probably for some obvious reason. I don't even know if Harlowe recognizes cycling links in this way. If not, is there some other way I could differentiate link types? Or perhaps I need to be adding this to the post itself? I tried that too, but no dice.


My other question, so as to not clog up the board even more, is about inserting audio into the story. I would like to implement looping background music. I've been looking around, but everything I've seen pertains to SugarCube and not to Harlowe. I tried using the SugarCube method, but surprise surprise, it wasn't compatible. I'm aware that I'll need to upload my music to a hosting site for this to work, but the ones other threads recommended are broken links. Is anyone aware of functioning sites I could use?
As a side note, I only have the one audio track for now, but in future I think I'll probably want to add new tracks for certain scenes or whatnot. I dont know if that influences the coding I should use or not.

Thank you so much for all your patience! I really am enjoying myself so far, even just with the learning process!

Comments

  • edited May 2016
    Simply use the html5 audio tag in your story.
    <audio src="./sounds_auto/sound.mp3" autoplay />
    

    With the attribute "autoplay" to have a background sound and the attribute "control" for a sound that the player can launch as he wants.
    You can see a short exemple of the result in that short demo story (in french).
  • 1. re: Using CSS to style Cycling Links

    The CSS selector you need is tw-link.cyclingLink, it consists of the type of element "tw-link" and the (sub-)class ".cyclingLink" of that element you want to effect. Both of these pieces of information are obtained from the <tw-link class='cyclingLink' ... code in your passage.

    If you plan to use CSS to style your story then you will need to learn about the format of CSS Selectors.

    2. re: Background sound.

    @Pierre is correct that you can use an audio element in your passage to play sound, although one downside of doing it that way is that the current sound will stop if the Reader navigates away from the current passage.

    The Fading out/Stopping Looped Music in Passage(s) thread explains a technique using Javascript that overcomes this issue. Read the whole thread before implementing the solution as there are changes near the end of that thread.
Sign In or Register to comment.