Howdy,
I stumbled upon a neat effect I’ve been working on implementing into my game. Using the Javascript from this forum post (How to create a *moving* color gradient in the background. - Twine Q&A), I can make a gradient background that moves up and down on repeat in a passage. I copy and pasted the code and it just straight-up worked. Awesome. I’ve been messing around with it though to get it to fit my needs, and that’s where I’m a little stuck. I want a gradient that basically moves ‘up’ the passage, going from white to sky blue and then stopping (as if you’re rising into the sky). I know how to change the colors and I got rid of the infinite
so the animation doesn’t loop, but I can’t figure out how to 1) change the “direction” of the animation, and 2) make it so it only goes up and then stops), not down and then back up (essentially, I want to get rid of the “bounce”). I’ve tried changing a few things and can’t find a solution, entirely because I don’t really understand most of the code used in the first place.
Anyway, here’s what I have currently in my Stylesheet (the passage tag is NextNext), which produces a gradient with a down-up-stop effect:
@-webkit-keyframes NextNext {
0%{background-position:50% 0%}
50%{background-position:50% 100%}
100%{background-position:50% 0%}
}
@-moz-keyframes NextNext {
0%{background-position:50% 0%}
50%{background-position:50% 100%}
100%{background-position:50% 0%}
}
@keyframes NextNext {
0%{background-position:50% 0%}
50%{background-position:50% 100%}
100%{background-position:50% 0%}
}
tw-story[tags~="NextNext"] {
background: linear-gradient(180deg, skyblue, white);
background-size: 400% 400%;
-webkit-animation: NextNext 7s ease;
-moz-animation: NextNext 7s ease;
animation: NextNext 7s ease;
}
I have a feeling the solution is very simple, but I am unfortunately a dummy. Thanks!