this code isn't working on chrome, it doesn't show anything
if I change the animation-duration from 5s to 2s, it will show it the wrong way.
here is CSS:
div{
--m0-: polygon(0 0,0 0,0 0,0 0);
--m1-: polygon(0 0,100% 0,100% 15%,0 0);
--m2-: polygon(0 0,3% 0,100% 15%,100% 16%);
--m3-: polygon(0 0,0 0,100% 15%,100% 36%);
--m4-: polygon(0 0,0 0,100% 36%,0 28%);
--m5-: polygon(0 28%,100% 36%,100% 37%,0 29%);
--m6-: polygon(0 29%,95% 37%,100% 55%,100% 55%);
--m7-: polygon(0 29%,20% 50%,100% 65%,0 50%);
--m8-: polygon(0 50%,100% 66%,100% 88%,66% 70%);
--m9-: polygon(0 50%,8% 70%,100% 95%,0 70%);
--m10-: polygon(0 70%,100% 100%,38% 100%,0 75%);
--m11-: polygon(0 100%,0 100%,0 100%,0 100%);
width: 100%;
height: 100%;
background-color: rgb(237,0,0);
position: absolute;
-webkit-clip-path:var(--m0-);
clip-path:var(--m0-);
-webkit-animation: show;
animation: show;
-webkit-animation-duration: .5s;
animation-duration: .5s;
-webkit-animation-iteration-count: 1;
animation-iteration-count: 1;
}
#-webkit-keyframes show{
0%{
clip-path: var(--m1-);
}
10%{
clip-path: var(--m2-);
}
20%{
clip-path: var(--m3-);
}
30%{
clip-path: var(--m4-);
}
40%{
clip-path: var(--m5-);
}
50%{
clip-path: var(--m6-);
}
60%{
clip-path: var(--m7-);
}
70%{
clip-path: var(--m8-);
}
80%{
clip-path: var(--m9-);
}
90%{
clip-path: var(--m10-);
}
100%{
clip-path: var(--m11-);
}
}
body only has a div
I added -webkit to the CSS provided but still nothing.
I tried to add -webkit- in my code but it didn't work;
but when i change animation-iteration-count: 1; to animation-iteration-count: infinite; it works!
Related
I'm currently trying to create a blinking eye effect with HTML and CSS. My problem is that the under part (eyelid) is moving the wrong way. It should be animated counterwise in order to look like the desired effect.
I already tired a lot of things to make it work and don't have any idea what else to do.
Here's my CSS. Is this a problem where some JS is needed as well?
.upper-eye {
background: linear-gradient(to bottom,
rgb(0, 0, 0),
rgba(255,255,255, 0) 10%);
width: 100%;
height: 300%;
z-index: 0;
position: fixed;
top:0;
left:0;
animation: bounce 2s linear infinite;
}
.under-eye {
background: linear-gradient(to top,
rgb(0, 0, 0),
rgba(255,255,255, 0) 10%);
width: 100%;
height: 300%;
z-index: 100;
position: fixed;
bottom: -10px;
left: 0;
animation: bounce 2s linear infinite;
}
#-webkit-keyframes bounce {
0%, 20%, 50%, 80%, 100% {-webkit-transform: translateY(0);}
40% {-webkit-transform: translateY(-30px);}
60% {-webkit-transform: translateY(-15px);}
}
#keyframes bounce {
0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
40% {transform: translateY(-30px);}
60% {transform: translateY(-15px);}
}
.bounce {
-webkit-animation-name: bounce;
animation-name: bounce;
}
The problem is that you're using the same #keyframes and expecting a different action. You might need to make a second #keyframes setting to do what you want but the other way around, then you could set that #keyframes to the bottom eyelid.
So it could look something like this:
#-webkit-keyframes bounceReverse {
0%, 20%, 50%, 80%, 100% {-webkit-transform: translateY(0);}
40% {-webkit-transform: translateY(-15px);}
60% {-webkit-transform: translateY(-30px);}
}
keyframes bounceReverse {
0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
40% {transform: translateY(-15px);}
60% {transform: translateY(-30px);}
}
bounceReverse {
webkit-animation-name: bounceReverse;
animation-name: bounceReverse;
}
You could also try using animation-direction: reverse; on the existing #keyframes animation to reverse the effect of the keyframe you're seeing correctly on the top eyelid.
When I try to activate any effect on a picture in my master page it just messes the whole order of the page and just ruins it. How can I fix it?
I just want a cool effect on my website.
body {
padding: 0;
margin: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #000;
}
.glitch {
position: relative;
overflow: hidden;
}
.glitch img {
position: relative;
z-index: 1;
display: block;
}
.glitch__layers {
position: absolute;
z-index: 2;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.glitch__layer {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-image: url(https://images.unsplash.com/photo-1561019733-a84b4e023910?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80);
background-repeat: no-repeat;
background-position: 0 0;
}
.glitch__layer:nth-child(1) {
transform: translateX(-5%);
animation: glitch-anim-1 2s infinite linear alternate;
}
.glitch__layer:nth-child(2) {
transform: translateX(3%) translateY(3%);
animation: glitch-anim-2 2.3s -.8s infinite linear alternate;
}
.glitch__layer:nth-child(3) {
transform: translateX(5%);
animation: glitch-anim-flash 1s infinite linear;
}
#keyframes glitch-anim-1 {
0% {
clip-path: polygon(0 0%, 100% 0%, 100% 5%, 0 5%);
}
10% {
clip-path: polygon(0 15%, 100% 15%, 100% 15%, 0 15%);
}
20% {
clip-path: polygon(0 10%, 100% 10%, 100% 20%, 0 20%);
}
30% {
clip-path: polygon(0 1%, 100% 1%, 100% 2%, 0 2%);
}
40% {
clip-path: polygon(0 35%, 100% 35%, 100% 35%, 0 35%);
}
50% {
clip-path: polygon(0 45%, 100% 45%, 100% 46%, 0 46%);
}
60% {
clip-path: polygon(0 50%, 100% 50%, 100% 70%, 0 70%);
}
70% {
clip-path: polygon(0 70%, 100% 70%, 100% 70%, 0 70%);
}
80% {
clip-path: polygon(0 80%, 100% 80%, 100% 80%, 0 80%);
}
90% {
clip-path: polygon(0 50%, 100% 50%, 100% 55%, 0 55%);
}
100% {
clip-path: polygon(0 60%, 100% 60%, 100% 70%, 0 70%);
}
}
#keyframes glitch-anim-2 {
0% {
clip-path: polygon(0 15%, 100% 15%, 100% 30%, 0 30%);
}
15% {
clip-path: polygon(0 3%, 100% 3%, 100% 3%, 0 3%);
}
25% {
clip-path: polygon(0 8%, 100% 8%, 100% 20%, 0 20%);
}
30% {
clip-path: polygon(0 20%, 100% 20%, 100% 20%, 0 20%);
}
45% {
clip-path: polygon(0 45%, 100% 45%, 100% 45%, 0 45%);
}
50% {
clip-path: polygon(0 50%, 100% 50%, 100% 57%, 0 57%);
}
65% {
clip-path: polygon(0 60%, 100% 60%, 100% 60%, 0 60%);
}
75% {
clip-path: polygon(0 80%, 100% 80%, 100% 80%, 0 80%);
}
80% {
clip-path: polygon(0 40%, 100% 40%, 100% 60%, 0 60%);
}
95% {
clip-path: polygon(0 45%, 100% 45%, 100% 60%, 0 60%);
}
100% {
clip-path: polygon(0 11%, 100% 11%, 100% 15%, 0 15%);
}
}
#keyframes glitch-anim-flash {
0% {
opacity: .2;
}
30%,
100% {
opacity: 0;
}
}
<div class="glitch">
<img src="https://images.unsplash.com/photo-1561019733-a84b4e023910?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80" alt="">
<div class="glitch__layers">
<div class="glitch__layer"></div>
<div class="glitch__layer"></div>
<div class="glitch__layer"></div>
</div>
</div>
I'm working in React js and am trying to emulate the vertical move up animation you see on the text "A DIGITAL DESIGN STUDIO
DRIVEN BY RESEARCH &
STRATEGY" here - https://dashdigital.studio/
From inspecting this site I have tried working with their translation CSS -
transition-delay: .9s;
transition: transform 1.3s cubic-bezier(.075, .82, .165, 1);
transform: translateY(0%);
However there is the "moving up from behind a wall" effect in use that I can't find a starting point for. Ideally I'd have this occur to elements on scroll - is there a package or starting point for anything like this?
How can I create this vertical wipe from behind a wall effect?
You can create vertically animation by following this code
html, body {
height: 100%;
}
body {
font-family: "Baloo Paaji", cursive;
background: #1e90ff;
display: flex;
justify-content: center;
align-items: center;
}
.container {
width: 400px;
height: 220px;
position: relative;
}
h1, h2 {
font-size: 75px;
text-transform: uppercase;
}
h1 span, h2 span {
width: 100%;
float: left;
color: #ffffff;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
transform: translateY(-150px);
opacity: 0;
-webkit-animation-name: titleAnimation;
animation-name: titleAnimation;
-webkit-animation-timing-function: ease;
animation-timing-function: ease;
-webkit-animation-duration: 3s;
animation-duration: 3s;
}
h1 span {
-webkit-animation-delay: 0.6s;
animation-delay: 0.6s;
-webkit-animation-fill-mode: forwards;
}
h1 span:first-child {
-webkit-animation-delay: 0.7s;
animation-delay: 0.7s;
}
h1 span:last-child {
color: #ffe221;
-webkit-animation-delay: 0.5s;
animation-delay: 0.5s;
}
h2 {
top: 0;
position: absolute;
}
h2 span {
-webkit-animation-delay: 4.1s;
animation-delay: 4.1s;
-webkit-animation-fill-mode: forwards;
}
h2 span:first-child {
-webkit-animation-delay: 4.2s;
animation-delay: 4.2s;
}
h2 span:last-child {
color: #ffe221;
-webkit-animation-delay: 4s;
animation-delay: 4s;
}
.usechrome {
font-size: 10px;
color: #fff;
font-family: helvetica, arial;
position: absolute;
bottom: 20px;
width: 100%;
text-align: center;
left: 0;
}
#-webkit-keyframes titleAnimation {
0% {
transform: translateY(-50px);
opacity: 0;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
}
20% {
transform: translateY(0);
opacity: 1;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
80% {
transform: translateY(0);
opacity: 1;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
100% {
transform: translateY(50px);
opacity: 0;
-webkit-clip-path: polygon(100% 0, 100% 0%, 0 100%, 0 100%);
clip-path: polygon(100% 0, 100% 0%, 0 100%, 0 100%);
}
}
#keyframes titleAnimation {
0% {
transform: translateY(-50px);
opacity: 0;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
}
20% {
transform: translateY(0);
opacity: 1;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
80% {
transform: translateY(0);
opacity: 1;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
100% {
transform: translateY(50px);
opacity: 0;
-webkit-clip-path: polygon(100% 0, 100% 0%, 0 100%, 0 100%);
clip-path: polygon(100% 0, 100% 0%, 0 100%, 0 100%);
}
}/*# sourceMappingURL=style.css.map */
<section class="container">
<h1 class="title">
<span>Hi, nice</span>
<span>to see</span>
<span>you here</span>
</h1>
<h2 class="title">
<span>This is</span>
<span>a long</span>
<span>sub title</span>
</h2>
</section>
<span class="usechrome">Use Chrome for a better experience</span>
How to stop the animation and keep the text when it comes to the 100% in keyframes, because it disappear when it reach 100%, well I did try infinite but it seems it wasn't fit for my taste, what I want is only two or more then display remain to its default style.
p span {
width: 100%;
float: left;
color: #ec1839;
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
transform: translateY(-50px);
opacity: 0;
animation-name: titleAnimation;
animation-timing-function:ease;
animation-iteration-count: 1;
animation-duration: 3s;
animation-delay: 1s;
animation-fill-mode: forwards;
}
#keyframes titleAnimation {
0% {
transform: translateY(-50px);
opacity: 0;
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
}
20% {
transform: translateY(0);
opacity: 1;
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
80% {
transform: translateY(0);
opacity: 1;
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
90% {
transform: translateY(50px);
opacity: 0;
clip-path: polygon(100% 0, 100% -0%, 0 100%, 0 100%);
}
}
<p><span>< Hi >, Nice to see you here</span></p>
The animation ends at 100%
Set 100% to desired end state for the animation
p span {
width: 100%;
float: left;
color: #ec1839;
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
transform: translateY(-50px);
opacity: 0;
animation-name: titleAnimation;
animation-timing-function:ease;
animation-iteration-count: 1;
animation-duration: 3s;
animation-delay: 1s;
animation-fill-mode: forwards;
}
#keyframes titleAnimation {
0% { // Starting condition
transform: translateY(-50px);
opacity: 0;
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
}
20% {
transform: translateY(0);
opacity: 1;
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
100% { // This where the animation will end and stay at
transform: translateY(0);
opacity: 1;
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
}
<p><span>< Hi >, Nice to see you here</span></p>
Im trying to make transitions very similar to what I have in the code example below. It works pretty well here, but when I use it on the real site it almost never works. Some transition-delays seem to be skipped and its not smooth like in this simplified example. On the site i'm trying to make this as part of a slideshow transition so other transitions are happening at the same time so i'm thinking the GPU can't handle the way I have it set up. Is there another way to accomplish this so that i'm not transitioning each div separately? Can I make one transition not start until the previous one has started? Possibly with keyframes or steps?
function toggleActive(){
var element = document.getElementById('wrap');
element.classList.toggle('active');
}
#wrap{
position:relative;
overflow:hidden;
}
#wrap img{
max-width:100%;
}
.diagonal-transition{
background-color:#edf8fb;
position: absolute;
height: 201%;
width:25%;
transform: rotate(45deg);
top: -200%;
opacity:.7;
transition-duration: .5s;
}
.diag-box-1{
left:67%;
}
.diag-box-2{
left:102.4%;
transition-delay: .5s;
}
.diag-box-3{
left:137.8%;
transition-delay: 1s;
}
.diag-box-4{
left:173.2%;
transition-delay: 1.5s;
}
.diag-box-5{
left:208.7%;
transition-delay: 2s;
}
.active .diag-box-1, .active .diag-box-2, .active .diag-box-3, .active .diag-box-4, .active .diag-box-5{
transform: rotate(45deg) translatey(100%);
}
<div id="wrap">
<img src="https://s8.postimg.cc/3q4ybyfad/parrot.jpg">
<div class="diagonal-transition diag-box-1"></div>
<div class="diagonal-transition diag-box-2"></div>
<div class="diagonal-transition diag-box-3"></div>
<div class="diagonal-transition diag-box-4"></div>
<div class="diagonal-transition diag-box-5"></div>
</div>
<button onclick="toggleActive()">ACTIVE STATE</button>
I would do this differently considering only backgrounds and only one animation. Then you can adjust background-size/background-position to control the behavior of the animation:
function toggleActive() {
var element = document.getElementById('wrap');
element.classList.toggle('active');
}
#wrap {
position: relative;
overflow: hidden;
width: 500px;
height: 300px;
background-image:
linear-gradient(120deg,transparent 0% ,rgba(237, 248, 251, 0.7) 0%,rgba(237, 248, 251, 0.7) 20%,transparent 20.5%),
linear-gradient(120deg,transparent 21%,rgba(237, 248, 251, 0.7) 20%, rgba(237, 248, 251, 0.7) 40%,transparent 40.5%),
linear-gradient(120deg,transparent 41%,rgba(237, 248, 251, 0.7) 40%, rgba(237, 248, 251, 0.7) 60%,transparent 60.5%),
linear-gradient(120deg,transparent 61%,rgba(237, 248, 251, 0.7) 60%, rgba(237, 248, 251, 0.7) 80%,transparent 80.5%),
linear-gradient(120deg,transparent 81%,rgba(237, 248, 251, 0.7) 80%, rgba(237, 248, 251, 0.7) 100%,transparent 100%),
url(https://s8.postimg.cc/3q4ybyfad/parrot.jpg);
background-position:0 0,0 0,0 0,0 0,0 0,center;
background-size: 0 100%,0 100%,0 100%,0 100%,0 100%,cover;
background-repeat: no-repeat;
}
.active {
animation:change 1s linear forwards;
}
#keyframes change {
0% {
background-size: 100% 0,100% 0,100% 0,100% 0,100% 0,cover;
}
20% {
background-size: 100% 100%,100% 0,100% 0,100% 0,100% 0,cover;
}
40% {
background-size: 100% 100%,100% 100%,100% 0,100% 0,100% 0,cover;
}
60% {
background-size: 100% 100%,100% 100%,100% 100%,100% 0,100% 0,cover;
}
80% {
background-size: 100% 100%,100% 100%,100% 100%,100% 100%,100% 0,cover;
}
100% {
background-size: 100% 100%,100% 100%,100% 100%,100% 100%,100% 100%,cover;
}
}
<div id="wrap">
</div>
<button onclick="toggleActive()">ACTIVE STATE</button>