Howdy, Stranger!

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

Make '@keyframes fadein' rule specific to one selector?

Sugarcube2.11.0

In my game, instead of having the links set to a different colour, I'm using a tactic which makes them slowly fade from a low opacity to full opacity over a time period.

I also have an intro or splash screen in which the title logo fades in by utilizing the exact same rule.

The problem which has developed today is that I've decided I want the passage links to fade from 0.5 opacity to full, rather than 0 to full, but because I use just the one CSS rule for this, my splash intro is affected the same way.

The fade-in durations can be set uniquely on both the links and the splash screen because that rule is unique to each of the selectors, but the one causing the problem is this rule:
@keyframes fadein {from {opacity: 0.5;} to {opacity: 1;}}
Because this isn't assigned to a unique selector, I can't stop it controlling the opacity on my splash screen.

Is there any way I can have the splash screen opacity set at 0 to 1, and the links opacity set at 0.5 to 1 ?

Comments

  • edited November 2016
    Big apologies for answering so many of my own questions, but I honestly believe it's the process of typing out the question that unlocks the answer for me.

    Anyway, dolt that I am, all I needed to do was change the 'fadein' name and make it unique for the splash screen selector. So instead of the one above, I use:
    @keyframes introfade {from {opacity: 0;} to {opacity: 1;}}
    
  • Simply change the name of the animation.
  • edited November 2016
    Just beat you to it, TME. Sorry. I initially presumed the 'fadein' was a set rule, in the same way 'opacity' or whatever is. Took a while to click I can call it whatever I want.
Sign In or Register to comment.