I’ve been playing around with some css animation
For example I have a rectangle representing a device. There will be multiple of these in a room. If the device goes into an error state the box shadow flashes red. User can then click on the device to open a new view to interact with the device. I also have a settings icon come into screen if the user holds down the mouse.
The blinking box shadow comes from custom CSS
@keyframes flashbox {
0% {box-shadow: 0px 0px 2px 1px rgba(255,0,0,0.4),0px 0px 12px 1px rgba(255,0,0,0.4) inset;}
70% {box-shadow: 0px 0px 6px 3px rgba(255,0,0,0.2),0px 0px 25px 2px rgba(255,0,0,0.2) inset;}
100% {box-shadow: 0px 0px 2px 1px rgba(255,0,0,0.3),0px 0px 12px 1px rgba(255,0,0,0.3) inset;}
}
and adding an ‘animation’ to the style set to flashbox 2s infinite
My question is…
Is there a way to generate and access an elements ‘pseudo-element’ like ‘before’ or ‘after’, or am I just wasting my time? When I have several devices animating on the same screen at the same time the client PC uses a surprising amount of resources (GPU). I’ve read, in a number of places, that rendering a pseudo-element and and altering it’s opacity is a lot less resource intensive
Is it possible to generate a pseudo-element in perspective utilizing a custom css file. I’ve tried, but I can’t seem to get it to work.
I can easily get the example in the link working at codepen.io
this is from chrome’s developer tools from my codepen example
But if I try to do it in perspective and look at chromes developer tool, it doesn’t seem to generate the after pseudo element and the function is greyed out.