It looks like you're new here. If you want to get involved, click one of these buttons!
html { background-image: url(Meander-Background-With-Side.png); background-size: cover; background-repeat: no-repeat; background-attachment: fixed; }
.myth html { background-image: url(Meander-Background-With-Side.png); background-size: cover; background-repeat: no-repeat; background-attachment: fixed; }does nothing, nor does the same code with html.myth.
body.myth { background-image: url(Meander-Background-With-Side.png); background-size: cover; background-repeat: no-repeat; background-attachment: fixed; }the result is the default SugarCube wherever I haven't already modified it, with a slice of my image, starting at the far left of the screen exactly high enough to catch the first piece of text, and extending far enough down to catch the last piece of text, but not showing the top of bottom of the image, just a slice from what would be the right place if the image was acting properly.
Comments
Three questions:
1. Which version of the SugarCube 1.x story format are you using?
2. What is the height/width of your image? (an example would be nice)
3. What is the height/width of your web-browser's view-port?
The reason I ask 2. & 3. is that the scaling done by the cover value can result in parts of the image being outside the view-port.
note: The image name in the url() function should be quoted.
1. SugarCube v1.0.35
2. 1870 x 944
3. 1920 x 944 - that might be my problem. I was working late last night when I made the images, I must have stuffed up somewhere and it's scaling so the 1870 becomes 1920, which of course makes the 944 too big.
An example of what happens when I use body.myth to insert the image is attached, as well as the version of Meander-Background-With-Side that has been corrected to 1920 wide (which was also what was used in the example).
So if you are using SC2 then your CSS is doing have to change a number of the defaults for the background image to cover the whole view-port. I would start with something like the following: ... you are going to have an issue with visual issue with the large orange area on the left side when people stow the side-bar.
I also tested your background image using SC1 and once I made my view-port big enough to see the whole patterned boarder I only had two issues:
1. the SC1's default side-bar only covered 2/3 - 3/4 of the orange area on the left side.
2. I had to move the left-hand side of the passage text area over a little.
To fix the problem of the massive blank space when the user stows the sidebar, is it possible to load a different image when the sidebar is stowed? With Classes or something? My original implementation was actually a border-image with a .svg, but I couldn't quite get that working. I've solved all the old problems with it, but would like to be able to alter the settings on the border-image when the user stows the sidebar.
Thanks for all the help so far!
EDIT: The code for my border-image:
And what I would want to do is, when the sidebar is stowed, switch to a different .svg and alter the left border-width and border-image-slice properties.
I played around with a version of your image without the left side and the best I could do was: ... which has the image on the #story element instead and handles the stowing/unstowing of the SC side-bar (including transition) but it has two major faults:
1. It scrolls with the scroll bar if the passage text is larger than the visible view-port, I had to remove background-attachment: fixed; because it causes parts of the image not to shown within borders or margins.
2. The top and bottom padding becomes to small as the image scales up to fit larger view-ports.
I think you need a CSS coder with more experience than me. lol
eg
html.image1 {
stuff;
transition: all 3s;
}
html.image2 {
stuff;
transition: all 3s;
}
<<addclass "html" "image1">>
<<removeclass "html" "image1">>
<<addclass "html" "image2">>
You need to use the remove class macro before each further change because you can only have one html layer at any one time.
Months since I did that, though.
However, shoving everything into the html or body sections is a little awkward. The best way to do this is to store images on many different divs at different z-index levels. That way you can define the dimensions of your own layers instead of forcing them into native sugarcube dimensions. This is how my game achieves its layering effects:
You can create these divs in javascript (don't know how off the top of my head) or just insert them straight into the HTML source like so:
With some native SugarCube html to show where you put it. The Custom div is the "top".
When you want to access them you can use sugarcube's <<addclass>> and <<removeclass>> macros. Though I use GreenSock animation to activate all my divs, since it's way less messy than inline macros and you don't need to use the <<timedreplace>> addon to do it.
Eg.
Is what activates the agent with rocket launcher in the video above.
Been a while since I checked Twine 2, but afaik all this is easier using Twine 1.4.1 tbh. Way easier to edit source HTML and insert greensock code.
Any ideas? The code I'm using to use the images all looks like this:
It used to look like this instead: But that stopped working when I imported the images. I was hoping the alteration would fix it, but no.
Oh, and most of them aren't .pngs, they're .svgs instead - which the Twine wiki says are supported, but that they won't show in the storymap. They more than don't show, they outright throw errors. Is that okay?
warning: If you are planing to use more than 50MB's (total) of images in your story then it is generally suggested that you use externally stored files because the Twine 1 application will start having "Out of Memory" errors during the building process once the total size of your Story Project (include child TWS files) reaches somewhere between 50-100MB.