Update: Twine 1. Obsolete script removed: use Twine 1.
If you like this code, consider using these macros that let you control tags inside the game. Ideally you could just do! Is it possible to change CSS depending on some variable? I'm working on a twine game at the moment where I wanted to give two different feels, so I thought this would be useful, but I can't get it to work! Admittedly, it's a while since I've used css, but I'm also using your dissolve, which is running fine, as long as I don't put this in too.
Do I need to add code after " Or only if I have older Twine I'm using 1. Create new account Request new password.
Twine Pictures, GIFs, and Background Images
Sekret Santa Ho ho ho! Potluck Party Newest Games 1hgj: Not Yet. Every Day is Valentine's Day. Who's online There are currently 0 users and guests online. L's blog Add new comment. Add new comment.For an overview of variable and conditionals download the variables in twine example. If you want to add an image to a passage you can use the html tag img specifying the full URL of the image on the internet. To use all of these features except for custom CSS for tagged passagesyou will need to use a story format that does not come installed with Twine 2.
Installing it is pretty easy! If you are on a Mac or Linuxthe path will look something like this.
Subscribe to RSS
But remember each path is specific to where it is on your machine! If you have trouble with this, feel free to get in touch with me via email. Now that your new story format is installed, it is available in a list of options when you change your story format. You can now use advanced macros, music, and other neat things built into this story format.
Full documentation is available here — or you can just download my example and play around with some options. Download a zip file containing a twine example using sugarcube and additional macros.Intro to Twine 2.0
CSS code doesn't include content, only how parts of a document will appear in the browser. To set the appearance of certain elements you need to know the names of the HTML elements. In case of twine2 there are only a few of them so it will be easy.
The property:value; syntax is mandatory, including the semicolon. Hexadecimal goes from 0 to F, where A is 10, B is 11, etc. The max value for any color is FF, or in decimal. When used to represent color, each third of the string represents a different color - red, green, and blue, in that order. So if we wanted to represent red with decimal notation, it'd look like this: Here's red in decimal notation: rgb0, 0 You can have a 4th channel too, which is the alpha, i.Twine Forum.
Howdy, Stranger! It looks like you're new here. If you want to get involved, click one of these buttons! Sign In Register. Categories Recent Discussions. Categories 4. March edited March in Workshop. T wine is a fantastic tool for quickly and easily making "choose your own adventure" games.
However, in my opinion, Sugarcane, Twine's default story formator "header," is a bit lacking in appearance. Neither Sugarcane's minimalistic design nor its white text on black background are the issue; it's just that Sugarcane makes a poor "one size fits all" format for the wide variety of Twine stories and games published.
Unfortunately, it is by by great and wide margin the most often used even when it's a painfully bad fit. Also, its text is much too small in my opinion and that's not an insignificant complaint because almost all of what makes a Twine game is the text.
The sidebar is a real eyesore when creating a custom layout that gets quickly thrown out, thus losing the use of Sugarcane's cool Rewind feature and the need for the StoryAuthor passage, but that's not a disadvantage. This may come as a huge shock, but one way around the issue is not to use Sugarcane.
I say that tongue-in-cheek, but I didn't know about the other two story formats for a month or more of using Twine. That's right, you heard it here first: Twine comes with two other story formats: Responsive and Jonah. To change the default story format, select another from the Story drop-down menu up at the top of the Twine window.
Responsive is basically another version of Sugarcane that's white with black text and the appearance of tabs at the top rather than a sidebar to the left. This format may or may not suit your game better though it would greatly benefit from increased text size as well. The other default story format is Jonah. It's much different. All the passages stay on the same page; a new passage appears below the old one.
If you've never looked at the other two story formats, give them a look-see. I'll wait. Let's begin. Twine creates HTML documents.This Twine macro lets you make the screen shake!
Tested in Chrome and Firefox. See a demo in action here. If you want to use this code or any other macro on your starting passage, you should put your start passage in a new passage called "ActualStart" and then put the following code in the Start passage:. This tells the screen to shake for a certain number of milliseconds. For example, if you want the screen to shake for 1. If you set the milliseconds to 0, the screen will shake forever until the reader moves to a new page!
Love this macro, but unfortunately it stopped working when I updated to 1. Skip to content. Instantly share code, notes, and snippets. Code Revisions 2 Stars 4 Forks 2. Embed What would you like to do? Embed Embed this gist in your website. Share Copy sharable link for this gist. Learn more about clone URLs. Download ZIP. Uses CSS3 animations. Paste the contents of the stylesheet.
Call the passage whatever you want, and add the tag "stylesheet" to it. Paste the contents of the script. Call the passage whatever you want, and add the tag "script" to it. Paste the contents of the twineCode file below into your 'ActualStart' passage described above.
A Total Beginner’s Guide to Twine 2.1
This will make the screen shake for 5 seconds! Adapted from Emmanuel Turner's article on creating Twine macros. This comment has been minimized. Sign in to view. Copy link Quote reply. You have Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window.I've modified my previous Sugarcane passage transition code to allow you to define your own transitions with CSS.
A very basic example is as follows:. In this case, it's a quarter-second, purely linear transition. Other options than "linear" are listed here. The maximum duration time before the departing passage is removed is 1 second. The current versions of Opera, Firefox and IE support the plain transition property, but you need to also include the -webkit variant in order to work in Chrome and Safari you can also include -khtml-transition for Konqueror users, few though they may be.
Now that you've defined the transition itself, you can define the styles that the passages can transition from and to. A very basic example:. In this case, it starts invisible "opacity:0" and fades in to visibility. Note the "position:absolute" - both "transition-in" and "transition-out" should have either position:absolute or position:fixed if you want them to neatly appear above or below each other.
With all 3 of these CSS snippets, you've replicated the "dissolve" transition linked above. If you use my tag-based passage CSS code, you can tie transitions to passages tagged with a particular tag. To see an example where the first four passages are tagged "t8n-dissolve" and the rest are not, see here. Fade in the default transition. Note that specifying passage. Retro 8-bit four-step fade in. Fade out. Vertical wipe Sadly, this currently only works if you give the passage div a fixed width and height.
If you use this, replace all instances of "px" and "px" with dimensions appropriate for your story. Zoom In. Fast scroll up Ideally you would use "vh" viewport height units instead of "rem" root em units, but not enough browsers support it yet. Garage door This would work well with a story whose passage divs have a fixed width and height, but unlike the vertical wipe it isn't strictly necessary.
Create new account Request new password. Sekret Santa Ho ho ho! Potluck Party Newest Games 1hgj: Not Yet. Every Day is Valentine's Day.I love that it makes it easy for regular people to make interactive stories and videogames.
These instructions apply to any story format in Twine, including the default Twine 2. Passages have two elements: a name and content. The content, on the other hand, is what the user sees when they reach that passage of the game.
To make a Twine game, all you need to know is how to make links between passages. Twine makes this pretty easy. While editing a passage, create links with [[ double square brackets ]]. For example. For instance, you could type. Twine will create links to passages called leftdoor and rightdoor, which are slightly easier to work with than the unwieldy longer names. There are lots of ways to make your Twine game look better with CSS or behave more like a game by adding variables and doing some programming.
All these instructions are based on the SugarCube 2 story format. Before beginning, make sure that your Twine game is set up for the SugarCube format.
One of the things I love about Twine is that it publishes to standard web formats. Because it uses these standard formats, your game can be played on basically every computer, phone, tablet, etc. By default, Twine games in SugarCube look pretty awful. That should motivate you to put your own personal visual stamp on your game. Good news: since you already know some CSS, this is pretty easy. Adding the following code, for instance, would change the background color to white, make the default color dark grey, change the default font to Futura, and make the default font size a little bigger:.
Okay, so that changes the default settings for your whole game. But what if you want only a particular passage to have its own background color, or its own special font? The first thing you need to do is open the passage you want to do something special with. Click on it to add a tag of your choosing. Write in the word hooray and click on the checkmark.These are some CSS snippets that alter the Sugarcane format. Insert them directly into a "stylesheet" passage in your Twine games to use them.
They probably won't work with Jonah, though. I don't consider myself a graphic designer or web designer, so these are to be regarded solely as amateur efforts.
Click here for live previews of all these stylesheets! Designed for slimy gloomy or spooky stories. It really looks like it fell in a swamp! The background image is not included - but if you add an embedded image with the name "background", it will be used by this stylesheet!
Twine: changing style and variables
This one simply consists of passage text, centered horizontally AND vertically inside the window, along with a colour gradient background. See the code comments for places where colours and values can easily be changed. See the code comments for colours and values that can be customised.
Ian Bogost. This stylesheet is capable of displaying a pixels-tall scene image above every passage's text! You can set scene images using Tag CSS. To have multiple images overlaid on each other, add multiple img declarations separated by commas, in order from frontmost to rearmost:.
No sidebar. Similar to ZX Spectwine, below. Reminiscent of early 90s Nintendo RPGs - hence its gray sensibilities. Use Tag CSS and tag your passages "mint", "strawberry", "banana" or "peanut" to get different coloured borders for specific passages!
Feel free to report any bugs to webbedspace.