Adding gif Effects Over Your Map
Adding custom effects like fog or flames over your maps

[ +- ] Code - open brackets removed for text wrapping to work
Code:
f=position:relative display:block]
map]
https://otfbm.io/59x50/@c40
--Background image
?bg=https://gpres.blob.core.windows.net/mistshore/map-hearthfire.jpg
/map]
f="position:absolute;display:block;top:.5em;bottom:.5em;left:0;right:0;background-image:url(https://i.imgur.com/FVjE590.gif);background-position-x:center;background-size:cover;background-repeat:no-repeat;mix-blend-mode:screen;pointer-events:none;opacity:.6"]/f]/f]

[ +- ] Code - open brackets removed for text wrapping to work
Code:
f=position:relative display:block]
map]
https://otfbm.io/59x50/@c40
--Background image
?bg=https://gpres.blob.core.windows.net/mistshore/map-hearthfire.jpg[/map]
f="position:absolute;display:block;top:2em;bottom:1.5em;left:0;right:0;background-image:url(https://i.imgur.com/FVjE590.gif);background-position-x:center;background-size:cover;background-repeat:no-repeat;mix-blend-mode:screen;pointer-events:none;opacity:.25"]/f]/f]
There is a bunch of coding here that just has to be, explaining it will probably be a waste of time if you're like me because all we really care about is the "how to" fix it part. I'll add a spoiler at the end to explain it all for the coders among us.
Outer f tag
The Outer f tag sets things up for the gif overlay to work, don't change anything
[f=position:relative display:block]( all the map and inner f tag stuff)[/f]
Inner f tag
the Inner f tag puts a second image usually an animated gif on top of the map and sets up it's size and position.
Code: with open brackets removed for word wrapping
f="position:absolute;display:block;top:.5em;bottom:.5em;left:0;right:0;background-image:url(https://i.imgur.com/FVjE590.gif);background-position-x:center;background-size:cover;background-repeat:no-repeat;mix-blend-mode:screen;pointer-events:none;opacity:.6"]/f]
What we adjust:
;top:.5em;bottom:.5em;left:0;right:0; <-- this sets the margins for the Gif.
(an em is based on the normal text size being used = it's usually 12 pixels high)
opacity:.6" <-- This sets the opacity of the gif to 60%, making it see through.
What changed from the top one to the bottom one?
If you'll notice, in the top image, the fog goes too high and it's really thick
I changed the (top:.5em;bottom:.5em;left:0;right:0;) to (top:2em;bottom:1.5em;left:0;right:0;).
That made the top of the gif lower and the bottom of the gif higher so it stayed inside the map.
Then I changed the (opacity:.6) to (opacity:.25)
That made the gif more transparent or the fog less thick so I could see the map better.
[ +- ] All the code mumbo jumbo
#Code Breakdown
[f=position:relative display:block[f="position:absolute;display:block;top:.5em;bottom:.5em;left:0;right:0;
background-image:url(https://i.imgur.com/FVjE590.gif);background-position-x:center;
background-size:cover;background-repeat:no-repeat;mix-blend-mode:screen;pointer-events:none;
opacity:.6"][/f][/f]
1. **Outer `f` tag**
- `position:relative`: This sets the position of the element to be relative to its normal position.
- `display:block`: This makes the element a block-level element, taking up the full width available.
2. **Inner `f` tag**
- `position:absolute`: This positions the element absolutely relative to its nearest positioned ancestor (which is the outer `f` tag in this case).
- `display:block`: This ensures the element is a block-level element.
- `top:.5em;bottom:.5em;left:0;right:0`: These styles position the element 0.5em from the top and bottom, and stretch it from the left to the right.
- `background-image:url(https://i.imgur.com/FVjE590.gif)`: This sets the background image of the element to the specified URL.
- `background-position-x:center`: This centers the background image horizontally.
- `background-size:cover`: This ensures the background image covers the entire element.
- `background-repeat:no-repeat`: This prevents the background image from repeating.
- `mix-blend-mode:screen`: This sets the blending mode to 'screen', which combines the background image with the background color.
- `pointer-events:none`: This makes the element ignore mouse events, so it doesn't interfere with user interactions.
- `opacity:.6`: This sets the opacity of the element to 60%, making it semi-transparent.
# Explanation
- **Outer `f` tag**: Acts as a container with relative positioning and block display.
- **Inner `f` tag**: Contains a background image, styled with absolute positioning and various CSS properties to achieve the desired visual effect. The inner element is semi-transparent and uses a blend mode to merge with the background color.
The inner `f` tag is placed absolutely within the outer `f` tag, taking up the full width and height (with some padding of `0.5em` from the top and bottom) and displaying a semi-transparent background image from the provided URL.
Return to top
Last edited February 21, 2025 12:32 pm