Replicating 2 different flicker animations on an SVG

The flicker you can see on here:

http://nueuphoria.com/

https://jsfiddle.net/s2z3xyd8/6/

Flicker
image

Intro
image

<div class="logo-load_w">

.logo-play_w svg path {
  stroke: #08f9ff;
  -webkit-animation: flicker-in-1 5s linear 5s infinite both;
  animation: flicker-in-1 5s linear 5s infinite both;
}

.logo-load_w svg path {
  stroke: #08f9ff;
  stroke-dasharray: 150;
  stroke-dashoffset: 1500;
  -webkit-animation: draw 20s infinite linear;
  animation: draw 20s infinite linear;
}

.cls-1 {
  fill: none;
  stroke: #fff;
  stroke-miterlimit: 10;
  stroke-width: 4px;
}

.cls-1 {
  fill: none;
  stroke: #fff;
  stroke-miterlimit: 10;
  stroke-width: 4px;
}

.cls-1 {
  fill: none;
  stroke: #fff;
  stroke-miterlimit: 10;
  stroke-width: 4px;
}

.cls-1 {
  fill: none;
  stroke: #fff;
  stroke-miterlimit: 10;
  stroke-width: 4px;
}

.cls-1 {
  fill: none;
  stroke: #fff;
  stroke-miterlimit: 10;
  stroke-width: 4px;
}

.cls-1 {
  fill: none;
  stroke: #fff;
  stroke-miterlimit: 10;
  stroke-width: 4px;
}

.cls-1 {
  fill: none;
  stroke: #fff;
  stroke-miterlimit: 10;
  stroke-width: 4px;
}

.cls-1 {
  fill: none;
  stroke: #fff;
  stroke-miterlimit: 10;
  stroke-width: 4px;
}

.cls-1 {
  fill: none;
  stroke: #fff;
  stroke-miterlimit: 10;
  stroke-width: 4px;
}

.cls-1 {
  fill: none;
  stroke: #fff;
  stroke-miterlimit: 10;
  stroke-width: 4px;
}

.cls-1 {
  fill: none;
  stroke: #fff;
  stroke-miterlimit: 10;
  stroke-width: 4px;
}

/*
0% {
    opacity: 0;
}
10% {
    opacity: 0;
}
10.1% {
    opacity: 1;
}
10.2% {
    opacity: 0;
}
20% {
    opacity: 0;
}
20.1% {
    opacity: 1;
}
20.6% {
    opacity: 0;
}
30% {
    opacity: 0;
}
30.1% {
    opacity: 1;
}
30.5% {
    opacity: 1;
}
30.6% {
    opacity: 0;
}
45% {
    opacity: 0;
}
45.1% {
    opacity: 1;
}
50% {
    opacity: 1;
}
55% {
    opacity: 1;
}
55.1% {
    opacity: 0;
}
57% {
    opacity: 0;
}
57.1% {
    opacity: 1;
}
60% {
    opacity: 1;
}
60.1% {
    opacity: 0;
}
65% {
    opacity: 0;
}
65.1% {
    opacity: 1;
}
75% {
    opacity: 1;
}
75.1% {
    opacity: 0;
}
77% {
    opacity: 0;
}
77.1% {
    opacity: 1;
}
85% {
    opacity: 1;
}
85.1% {
    opacity: 0;
}
86% {
    opacity: 0;
}
86.1% {
    opacity: 1;
}
100% {
    opacity: 1;
}
0% {
    opacity: 0;
}
10% {
    opacity: 0;
}
10.1% {
    opacity: 1;
}
10.2% {
    opacity: 0;
}
20% {
    opacity: 0;
}
20.1% {
    opacity: 1;
}
20.6% {
    opacity: 0;
}
30% {
    opacity: 0;
}
30.1% {
    opacity: 1;
}
30.5% {
    opacity: 1;
}
30.6% {
    opacity: 0;
}
45% {
    opacity: 0;
}
45.1% {
    opacity: 1;
}
50% {
    opacity: 1;
}
55% {
    opacity: 1;
}
55.1% {
    opacity: 0;
}
57% {
    opacity: 0;
}
57.1% {
    opacity: 1;
}
60% {
    opacity: 1;
}
60.1% {
    opacity: 0;
}
65% {
    opacity: 0;
}
65.1% {
    opacity: 1;
}
75% {
    opacity: 1;
}
75.1% {
    opacity: 0;
}
77% {
    opacity: 0;
}
77.1% {
    opacity: 1;
}
85% {
    opacity: 1;
}
85.1% {
    opacity: 0;
}
86% {
    opacity: 0;
}
86.1% {
    opacity: 1;
}
100% {
    opacity: 1;
}
0% {
    opacity: 0;
}
10% {
    opacity: 0;
}
10.1% {
    opacity: 1;
}
10.2% {
    opacity: 0;
}
20% {
    opacity: 0;
}
20.1% {
    opacity: 1;
}
20.6% {
    opacity: 0;
}
30% {
    opacity: 0;
}
30.1% {
    opacity: 1;
}
30.5% {
    opacity: 1;
}
30.6% {
    opacity: 0;
}
45% {
    opacity: 0;
}
45.1% {
    opacity: 1;
}
50% {
    opacity: 1;
}
55% {
    opacity: 1;
}
55.1% {
    opacity: 0;
}
57% {
    opacity: 0;
}
57.1% {
    opacity: 1;
}
60% {
    opacity: 1;
}
60.1% {
    opacity: 0;
}
65% {
    opacity: 0;
}
65.1% {
    opacity: 1;
}
75% {
    opacity: 1;
}
75.1% {
    opacity: 0;
}
77% {
    opacity: 0;
}
77.1% {
    opacity: 1;
}
85% {
    opacity: 1;
}
85.1% {
    opacity: 0;
}
86% {
    opacity: 0;
}
86.1% {
    opacity: 1;
}
100% {
    opacity: 1;
}
0% {
    opacity: 0;
}
10% {
    opacity: 0;
}
10.1% {
    opacity: 1;
}
10.2% {
    opacity: 0;
}
20% {
    opacity: 0;
}
20.1% {
    opacity: 1;
}
20.6% {
    opacity: 0;
}
30% {
    opacity: 0;
}
30.1% {
    opacity: 1;
}
30.5% {
    opacity: 1;
}
30.6% {
    opacity: 0;
}
45% {
    opacity: 0;
}
45.1% {
    opacity: 1;
}
50% {
    opacity: 1;
}
55% {
    opacity: 1;
}
55.1% {
    opacity: 0;
}
57% {
    opacity: 0;
}
57.1% {
    opacity: 1;
}
60% {
    opacity: 1;
}
60.1% {
    opacity: 0;
}
65% {
    opacity: 0;
}
65.1% {
    opacity: 1;
}
75% {
    opacity: 1;
}
75.1% {
    opacity: 0;
}
77% {
    opacity: 0;
}
77.1% {
    opacity: 1;
}
85% {
    opacity: 1;
}
85.1% {
    opacity: 0;
}
86% {
    opacity: 0;
}
86.1% {
    opacity: 1;
}
100% {
    opacity: 1;
}


  <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 47.96 51.66"><defs><style>.cls-1{fill:none;stroke:#fff;stroke-miterlimit:10;stroke-width:4px;}</style></defs><g id="Слой_2" data-name="Слой 2"><g id="play"><path class="cls-1" d="M2,25.83V4.11A2.11,2.11,0,0,1,5.13,2.27L44.88,24.45a2.11,2.11,0,0,1,0,3.7L5.1,49.41A2.11,2.11,0,0,1,2,47.55V25.83"></path></g></g></svg></div>

I think this goes with the intro one:


#logo-load_w svg {
    -webkit-animation: flicker-1 2s linear 2s infinite both;
    animation: flicker-1 2s linear 2s infinite both;
}
#logo-load svg {
    width: 70px;
    left: 50%;
    margin-left: -35px;
    top: 50%;
    margin-top: -35px;
    position: fixed;
}

0%, 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}
0%, 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}
0%, 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}
0%, 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}
0%, 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}
0%, 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}

The animated triangle is nifty, but that background flicker is horrible; it makes me feel ill. I’d seriously rethink using it.

1 Like

I want to know how it’s made, looks pretty cool. I believe it uses @keyframes which I don’t know how that works. Either @paulOB or @ray.h helped me with one of these before, or both. Most likely both.

Hi there asasass,

here is the draw method…

<!DOCTYPE HTML>
<html lang="en">
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">

<title>untitled document</title>

<!--<link rel="stylesheet" href="screen.css" media="screen">-->

<style media="screen">
body {
    background-color: #f9f9f9;
    font: 100% / 162% verdana, arial, helvetica, sans-serif;
 }

#triangle {
    display: block;
    padding: 0.5em;
    margin: auto;
    background-color: #20007d;
 }

#triangle path {
    stroke: #08f9ff;
    stroke-dasharray: 150;
    stroke-dashoffset: 1500;
    animation: draw 20s infinite linear;
}

@keyframes draw {
to {
    stroke-dashoffset: 0;
   }
 }
</style>

</head>
<body> 

<svg  
    id="triangle" 
    xmlns="http://www.w3.org/2000/svg" 
    width="80" 
    height="80" 
   viewBox="0 0 48 52">

 <defs>
  <style> 
   path {
       fill: none;
       stroke: #fff;
       stroke-miterlimit: 10;
       stroke-width: 4px;
    }
  </style>
 </defs>

 <g>
  <path d="M2,25.83V4.11A2.11,2.11,0,0,1,5.13,2.27L44.88,24.45a2.11,2.11,0,0,1,0,3.7L5.1,49.41A2.11,2.11,0,0,1,2,47.55V25.83"/>
 </g>

</svg>

</body>
</html>

Note:- The animation does not work in IE11.

Please do not ask me for a flickering example. :unhappy:

coothead

3 Likes

Thanks for that.

Now I’m just waiting for the flickering one. Maybe that’s a more difficult one.

It’s the one where it flickers in and out.

Hi there asasass,

I wouldn’t have thought so. :unhappy:

But, on principal, I will never ever create flickering items. :rolleyes:

coothead

3 Likes

I’m working on this part:

@keyframes flicker - 1

0%, 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}

@keyframes flicker - 1

100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}
@keyframes flicker - 1

 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}

@keyframes flicker - 1

0%, 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}

@keyframes flicker - 1

0%, 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}

At the risking of annoying @coothead (and all your visitors) you could try something like this.:slight_smile:

#triangle path {
    stroke: #08f9ff;
    stroke-dasharray: 150;
    stroke-dashoffset: 1500;
    animation: draw 5s infinite linear;
}

@keyframes draw {
0% {stroke-width: 0px;}
9% {stroke-width: 0px;}
10% {stroke-width: 4px;}
20% {stroke-width: 4px;} 
21% {stroke-width: 0px;} 
35% {stroke-width: 4px;}  
36% {stroke-width: 4px;}  
46% {stroke-width: 0px;}  
56% {stroke-width: 4px;}  
66% {stroke-width: 0px;}  
86% {stroke-width: 4px;}  
}

Just tweak until it suits.

Isn’t this what goes with it?


  animation: flicker-1 2s linear 2s infinite both;

Isn’t that different from this?


@keyframes flicker - 1

0%, 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}

@keyframes flicker - 1

100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}
@keyframes flicker - 1

 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}

@keyframes flicker - 1

0%, 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}

@keyframes flicker - 1

0%, 100% {
    opacity: 1;
}
41.99% {
    opacity: 1;
}
42% {
    opacity: 0;
}
43% {
    opacity: 0;
}
43.01% {
    opacity: 1;
}
47.99% {
    opacity: 1;
}
48% {
    opacity: 0;
}
49% {
    opacity: 0;
}
49.01% {
    opacity: 1;
}

Same technique I just animated the width of the line rather than the opacity as your original seemed to do that. There’s not a lot of difference.

I have this part set:

@keyframes flicker {
  0%,
  100% {
    opacity: 1;
  }
  41.99% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  43% {
    opacity: 0;
  }
  43.01% {
    opacity: 1;
  }
  47.99% {
    opacity: 1;
  }
  48% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  49.01% {
    opacity: 1;
  }
}

@keyframes flicker {
  100% {
    opacity: 1;
  }
  41.99% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  43% {
    opacity: 0;
  }
  43.01% {
    opacity: 1;
  }
  47.99% {
    opacity: 1;
  }
  48% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  49.01% {
    opacity: 1;
  }
}

@keyframes flicker {
  100% {
    opacity: 1;
  }
  41.99% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  43% {
    opacity: 0;
  }
  43.01% {
    opacity: 1;
  }
  47.99% {
    opacity: 1;
  }
  48% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  49.01% {
    opacity: 1;
  }
}

@keyframes flicker {
  0%,
  100% {
    opacity: 1;
  }
  41.99% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  43% {
    opacity: 0;
  }
  43.01% {
    opacity: 1;
  }
  47.99% {
    opacity: 1;
  }
  48% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  49.01% {
    opacity: 1;
  }
}

@keyframes flicker {
  0%,
  100% {
    opacity: 1;
  }
  41.99% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  43% {
    opacity: 0;
  }
  43.01% {
    opacity: 1;
  }
  47.99% {
    opacity: 1;
  }
  48% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  49.01% {
    opacity: 1
  }
}

What am I forgetting to do?
https://jsfiddle.net/v9xq71pz/2/


body {
    background-color: #f9f9f9;
    font: 100% / 162% verdana, arial, helvetica, sans-serif;
 }

#triangle {
    display: block;
    padding: 0.5em;
    margin: auto;
    background-color: #20007d;
 }

#triangle path {
    stroke: #08f9ff;
    stroke-dasharray: 150;
    stroke-dashoffset: 1500;
    animation: flicker-1 2s linear 2s infinite both;
}



@keyframes flicker {
  0%,
  100% {
    opacity: 1;
  }
  41.99% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  43% {
    opacity: 0;
  }
  43.01% {
    opacity: 1;
  }
  47.99% {
    opacity: 1;
  }
  48% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  49.01% {
    opacity: 1;
  }
}

@keyframes flicker {
  100% {
    opacity: 1;
  }
  41.99% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  43% {
    opacity: 0;
  }
  43.01% {
    opacity: 1;
  }
  47.99% {
    opacity: 1;
  }
  48% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  49.01% {
    opacity: 1;
  }
}

@keyframes flicker {
  100% {
    opacity: 1;
  }
  41.99% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  43% {
    opacity: 0;
  }
  43.01% {
    opacity: 1;
  }
  47.99% {
    opacity: 1;
  }
  48% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  49.01% {
    opacity: 1;
  }
}

@keyframes flicker {
  0%,
  100% {
    opacity: 1;
  }
  41.99% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  43% {
    opacity: 0;
  }
  43.01% {
    opacity: 1;
  }
  47.99% {
    opacity: 1;
  }
  48% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  49.01% {
    opacity: 1;
  }
}

@keyframes flicker {
  0%,
  100% {
    opacity: 1;
  }
  41.99% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  43% {
    opacity: 0;
  }
  43.01% {
    opacity: 1;
  }
  47.99% {
    opacity: 1;
  }
  48% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  49.01% {
    opacity: 1
  }
}

You haven’t used the right animation name.

animation: flicker 2s linear 2s infinite both;

Also why are you repeating the same keyframes over and over again? You only need one set.

I would add this whole thing in:

   animation: flicker-1 2s linear 2s infinite both;
        animation-name: flicker-1;
        animation-duration: 2s;
        animation-timing-function: linear;
        animation-delay: 2s;
        animation-iteration-count: infinite;
        animation-direction: normal;
        animation-fill-mode: both;
        animation-play-state: running;
}

How come it’s stated in here 6 times?
What does that mean?
https://jsfiddle.net/v9xq71pz/6/

Would this get added also, because in the browser there’s a line through it?

-webkit-animation: flicker-1 2s linear 2s infinite both;

Idon’t need all of this, right?

 animation-name: flicker-1;
  animation-duration: 2s;
  animation-timing-function: linear;
  animation-delay: 2s;
  animation-iteration-count: infinite;
  animation-direction: normal;
  animation-fill-mode: both;
  animation-play-state: running;

All I need is this part?
animation: flicker-1 2s linear 2s infinite both;

that, and does this get added too?
-webkit-animation: flicker-1 2s linear 2s infinite both;

You don;t really need prefixes (i.e. -webkit etc…) these days for animations.

All you need is the one set.

e.g.

#triangle path {
    stroke: #08f9ff;
    stroke-dasharray: 150;
    stroke-dashoffset: 1500;
    animation: flicker-1 2s linear 2s infinite both;
}

@keyframes flicker-1 {
  0%,
  100% {
    opacity: 1;
  }
  41.99% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  43% {
    opacity: 0;
  }
  43.01% {
    opacity: 1;
  }
  47.99% {
    opacity: 1;
  }
  48% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  49.01% {
    opacity: 1;
  }
}
1 Like

Which one does this fall under?

CSS Animation
https://caniuse.com/#search=animation