I have made a typing animation in CSS. I have an issue with the letter not showing up fully.
Trying to make "m" as one letter, Also animation to feel more natural. It needs to look like someone is typing.
need help to animate each letter in the "remirror" separately and make it look like someone is typing so each key comes in slightly off time.
https://codepen.io/shahil/pen/ZEGwMxQ
#font-face {
font-family: danub;
src: url(https://cdn.getforge.com/remirror.getforge.io/1585586993/danub.ttf);
}
#-webkit-keyframes typing {
from {
width: 0;
}
to {
width: 16.3em;
}
}
#-moz-keyframes typing {
from {
width: 0;
}
to {
width: 16.3em;
}
}
#-webkit-keyframes blink-caret {
from,
to {
border-color: transparent;
}
50% {
border-color: black;
}
}
#-moz-keyframes blink-caret {
from,
to {
border-color: transparent;
}
50% {
border-color: black;
}
}
body {
font-family: Consolas, monospace;
}
h1 {
font-size: 3rem;
width: 16.3em;
white-space: nowrap;
overflow: hidden;
color: #000;
border-right: 0.1em solid black;
font-family: danub;
-webkit-animation: typing 17s steps(30, end),
/* # of steps = # of characters */ blink-caret 1s step-end infinite;
}
<h1>remirror</h1>
If the word won't change you can try animating the content property of a pseudo-Element.
#font-face {
font-family: danub;
src: url(https://cdn.getforge.com/remirror.getforge.io/1585586993/danub.ttf);
}
/* For the caret */
h1:before {
content: '';
}
/* For the word */
h1:after {
content: '';
font-family: danub;
border-right: 0.1em solid black;
animation: typing 3s steps(8) forwards, blink-caret 1s step-end infinite;
}
#keyframes typing {
0% {
content: ''
}
12.5% {
content: 'r'
}
25% {
content: 're'
}
37.5% {
content: 'rem'
}
50% {
content: 'remi'
}
62.5% {
content: 'remir'
}
75% {
content: 'remirr'
}
87.5% {
content: 'remirro'
}
100% {
content: 'remirror'
}
}
#keyframes blink-caret {
from,
to {
border-color: transparent;
}
50% {
border-color: black;
}
}
<h1></h1>
Here is a crazy idea relying on background and box-decoration trick. It can also work with any kind of font-family:
#font-face {
font-family: danub;
src: url(https://cdn.getforge.com/remirror.getforge.io/1585586993/danub.ttf);
}
h1 {
font-size: 3rem;
height:1.1em; /* Same a gradient height */
line-height:1.3em; /* to rectify the oveflow (bigger than the height) */
word-break: break-all; /* This is the most important trick */
overflow: hidden; /* hide the line break */
font-family: danub;
animation:typing 10s linear forwards;
}
h1 span{
/* padding same as gradient width */
padding-right:0.1em; /* width height */
background:linear-gradient(red,red) right/ 0.1em 1.1em no-repeat;
-webkit-box-decoration-break:clone;
box-decoration-break:clone;
animation:blink-caret 0.5s infinite forwards;
}
#keyframes typing {
from {
max-width: 1em;
}
to {
max-width:100%;
}
}
#keyframes blink-caret {
to {
/* we change the gradient to transparent */
background-image:linear-gradient(transparent,transparent);
}
}
<h1><span>remirror text</span></h1>
<h1 style="font-family:arial"><span>another text here</span></h1>
To udnerstand the trick remove the overflow to see how the gradient behave with box-decoration:
#font-face {
font-family: danub;
src: url(https://cdn.getforge.com/remirror.getforge.io/1585586993/danub.ttf);
}
h1 {
font-size: 3rem;
height:1.1em; /* Same a gradient height */
line-height:1.2em; /* to rectify the oveflow */
word-break: break-all; /* This is the most important trick */
font-family: danub;
animation:typing 25s linear forwards;
border:1px solid;
}
h1 span{
padding-right:0.1em; /* width height */
background:linear-gradient(red,red) right/ 0.1em 1.1em no-repeat;
-webkit-box-decoration-break:clone;
box-decoration-break:clone;
}
#keyframes typing {
from {
max-width: 1em;
}
to {
max-width:100%;
}
}
<h1><span>remirror text</span></h1>
Related
An example of what I want (the main text eg. subscribe): https://sounddrout.com/
My code basically has a repeating typewriter effect on it and it just goes from right to left. Although I want it to do so but in a centered fashion (Check the website linked as an example). I want it to come out from the middle so its equal on both sides and expands out. Think like the center thing in google docs.
body {
margin: 0px;
}
.container {
display: grid;
grid-template-columns: 1fr;
}
/*Text*/
.font {
font-family: 'Source Sans Pro', monospace;
}
.mid {
text-align: center;
}
.txtsize {
font-size: 40px;
}
h1 {
width: max-content;
position: relative;
font-size: 40px;
display: grid;
}
.textbody {
margin: 120px;
font-family: "Source Sans Pro", sans-serif;
display: grid;
place-content: center;
text-align: center;
background: var(--bg-color);
font: 200;
}
/*typwriter*/
:root {
--bg-color: hsl;
--typewriterSpeed: 5s;
--blinkLength: 650ms;
--typewriterCharacters: 20;
}
/* Type Writer Effect */
h1::before,
h1::after {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
h1::before {
background: white;
animation: typewriter var(--typewriterSpeed) steps(20) infinite;
}
h1::after {
width: 0.1em;
background: black;
animation: typewriter var(--typewriterSpeed) steps(20) infinite;
}
#keyframes typewriter {
from {
left: 0%;
}
45% {
left: 100%;
}
65% {
left: 100%;
}
85% {
left: 0%;
}
to {
left: 0%;
}
}
#keyframes blink {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<body>
<div class="textbody">
<h1>
Subscribe To FuryRex09
</h1>
</div>
</body>
Any ideas?
Sorry if I wasn't very clear I had a lot of trouble explaining my issue.
P.S here's a Codepen - https://codepen.io/furyrex09/pen/bGaybOe (;
if you can use JavaScript . this we be lot easier to do .
$("#typed").typed({
strings: ["This is first.", "This is second.", "Add any text you like here."],
typeSpeed: 100,
startDelay: 0,
backSpeed: 60,
backDelay: 2000,
loop: true,
cursorChar: "|",
contentType: 'html'
});
#import url('https://fonts.googleapis.com/css?family=Work+Sans');
html, body {
height: 100vh;
font-family: 'Work Sans', sans-serif;
font-weight: bold;
color: #fff;
letter-spacing: 5px;
}
body {
display: flex;
justify-content: center;
align-items: center;
background-size: cover;
background: linear-gradient(to right, #0cebeb, #20e3b2, #29ffc6);
margin: 0;
}
.type-wrap {
font-size: 50px;
padding: 20px;
}
/* the above is for styling puposes only */
.typed-cursor{
opacity: 1;
-webkit-animation: blink 0.7s infinite;
-moz-animation: blink 0.7s infinite;
animation: blink 0.7s infinite;
}
#keyframes blink{
0% { opacity:1; }
50% { opacity:0; }
100% { opacity:1; }
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/typed.js/1.1.1/typed.min.js"></script>
<div class="type-wrap">
<span id="typed" style="white-space:pre;" class="typed">
</span>
</div>
Here's my solution to this:
// TYPEWRITER //
const typedTextSpan = document.querySelector(".typed-text");
const cursorSpan = document.querySelector(".cursor");
const textArray = ["YouTuber", "Writer", "Designer", "Creator", "Programmer", "Gamer"]
const typingDelay = 200;
const erasingDelay = 100;
const newTextDelay = 2000;
let textArrayIndex = 0;
let charIndex = 0;
function type() {
if(charIndex < textArray[textArrayIndex].length) {
if(!cursorSpan.classList.contains("typing")) cursorSpan.classList.add("typing");
typedTextSpan.textContent += textArray[textArrayIndex].charAt(charIndex);
charIndex++;
setTimeout(type, typingDelay);
}
else {
cursorSpan.classList.remove("typing");
setTimeout(erase, newTextDelay);
}
}
function erase() {
if(charIndex > 0) {
if(!cursorSpan.classList.contains("typing")) cursorSpan.classList.add("typing");
typedTextSpan.textContent = textArray[textArrayIndex].substring(0,charIndex-1);
charIndex--;
setTimeout(erase, erasingDelay)
}
else {
cursorSpan.classList.remove("typing");
textArrayIndex++;
if(textArrayIndex>=textArray.length) textArrayIndex=0;
setTimeout(type, typingDelay + 800);
}
}
document.addEventListener("DOMContentLoaded", function() {
if(textArray.length) setTimeout(type, newTextDelay + 250);
});
/* Text */
h1 {
position: relative;
font-size: 40px;
}
.textbody {
margin-top: 100px;
font-family: "Source Sans Pro", sans-serif;
font-weight: bold;
background: var(--bg-color);
font: 200;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
}
.typed-text {
font-weight: normal;
color: #dd7732;
}
/* Root */
:root {
--bg-color: hsl;
--typewriterSpeed: 5s;
--blinkLength: 825ms;
--typewriterCharacters: 20;
}
/* Type Writer Effect */
.cursor {
display: inline-block;
width: 3px;
background-color: #ccc;
margin-left: 0.1rem;
animation: blink 1s infinite;
}
.cursor.typing {
animation: none;
}
#keyframes blink {
0% {background-color: #ccc;}
49% {background-color: #ccc; }
50% {background-color: transparent; }
99% {background-color: transparent; }
100% {background-color: #ccc; }
}
<body>
<div class="textbody">
<h1>
I am a <span class="typed-text"></span><span class="cursor typing"> </span>
</h1>
</div>
<script src="main.js"></script>
</body>
Since my title is all there is to ask,
here is my html code:
<div class="line typewriter">
<h1> My name </h1>
<h4>Data Scientist | Environmental Enthusiast |   Traveller</h4>
</div>
and my css code:
.line {
/* position: relative; */
top:50%;
width: 50%;
margin: 0 auto;
text-align: center;
white-space: nowrap;
overflow: hidden;transform: translateY(~50%);
}
.typewriter {
animation: type 7s steps(35, end) 0.5s,
blinkTextCursor 500ms steps(10) infinite normal;
/* overflow: hidden;
white-space: nowrap; */
}
#keyframes type {
from {
width:0%;
}
to {
width: 100%;
}
}
Also my text-writer does not look smooth, how can I make it smoother?
It will go along as per content.
Try this:
.typewriter{
position:relative;
display: inline-block;
}
.typewriter h4 {
color: #000;
font-family: monospace;
overflow: hidden;
border-right: .15em solid orange;
white-space: nowrap;
margin: 0 auto;
letter-spacing: .15em;
animation: typing 3.5s steps(30, end), blink-caret .5s step-end infinite;
}
/* The typing effect */
#keyframes typing {
from {
width: 0
}
to {
width: 100%
}
}
/* The typewriter cursor effect */
#keyframes blink-caret {
from,
to {
border-color: transparent
}
50% {
border-color: orange
}
}
<div class=" typewriter">
<h4>Data Scientist | Environmental Enthusiast |   Traveller</h4>
</div>
I need do the next animation of text:
People dissapears like a flip effect David Walsh Flip Card Effect, and the effect faces every 2 seconds and it will be repeating, contents the text: "Robots", "Animals", "Things" for example, with the flip animation.
Any idea?
One example of flip cards is the next: Stackoverflow How to flip multiple divs using CSS?
#import url('https://fonts.googleapis.com/css?family=Roboto:300');
.divi {
line-height: normal;
color: black;
text-shadow: 0 0 0.2em #87F, 0 0 0.2em #87F, 0 0 0.2em #87F;
}
.div1 { /* For increasing performance ID/Class should've been used. For a small demo it's okaish for now */
animation: showup 7s forwards;
font-family:'Roboto';
font-weight:300;
font-size:28px;
overflow:hidden;
display:inline-block;
white-space:nowrap;
}
.div2 {
font-family: 'Roboto';
font-weight: 300;
font-size: 28px;
overflow: hidden;
width: 0px;
animation: reveal 7s forwards;
animation-iteration-count: 1;
display: inline-block;
white-space: nowrap;
}
.div2 span {
font-family: 'Roboto';
font-weight: 300;
font-size: 28px;
overflow: hidden;
margin-left: -355px;
animation: slidein 7s forwards;
}
#keyframes showup {
0% {
opacity: 0;
}
20% {
opacity: 1;
}
80% {
opacity: 1;
}
100% {
opacity: 1;
}
}
#keyframes slidein {
0% {
margin-left: -800px;
}
20% {
margin-left: -800px;
}
35% {
margin-left: 0px;
}
100% {
margin-left: 0px;
}
}
#keyframes reveal {
0% {
opacity: 0;
width: 0px;
}
20% {
opacity: 1;
width: 0px;
}
30% {
width: auto;
}
80% {
opacity: 1;
}
100% {
opacity: 1;
width: auto;
}
}
<div class="divi" align="center">
<div class="div1">Hello</div>
<div class="div2">
<span>People</span>
</div>
<div class="div3">
<span>Robots</span>
</div>
<div class="div4">
<span>Animals</span>
</div>
<div class="div5">
<span>Things</span>
</div>
</div>
There is h1 tag in the body which has Some Text Hello Some Text.
But while executing the word Hello is missed. Why?.
On view-source: it shows that there is a word written.
How to solve that?
.container {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
/*background-color: red*/
}
.clr {
color: #f35626;
background-image: -webkit-linear-gradient(92deg,#f35626,#feab3a);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-animation: hue 30s infinite linear;
}
#-webkit-keyframes hue {
from {
-webkit-filter: hue-rotate(0deg);
}
to {
-webkit-filter: hue-rotate(360deg);
}
}
.awesome {
font-family: futura;
font-style: italic;
color:#313131;
font-size:45px;
font-weight: bold;
position: absolute;
-webkit-animation:colorchange 20s infinite alternate;
}
#-webkit-keyframes colorchange {
0% {
color: blue;
}
10% {
color: #8e44ad;
}
20% {
color: #1abc9c;
}
30% {
color: #d35400;
}
40% {
color: blue;
}
50% {
color: #34495e;
}
60% {
color: blue;
}
70% {
color: #2980b9;
}
80% {
color: #f1c40f;
}
90% {
color: #2980b9;
}
100% {
color: pink;
}
}
<!DOCTYPE html>
<html><head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body class=""><div class="container"><br /><br /><center><b><h2 class="clr">नमस्ते</h2><br /><h1 class="clr">Some Text <span class="awesome">HELLO</span> Some Text</h1></b></center></div></body></html>
There is h1 tag in the body which has Some Text Hello Some Text.
But while executing the word Hello is missed. Why?.
On view-source: it shows that there is a word written.
How to solve that?
The Tidy Js fiddle
First you have to correct your markup as you have obsolete tags and don't use absolute position. Then simply put back the text-fill to initial.
.container {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
/*background-color: red*/
}
.clr {
text-align:center;
font-weight:bold;
color: #f35626;
background-image:linear-gradient(92deg, #f35626, #feab3a);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
animation: hue 30s infinite linear;
}
#keyframes hue {
from {
-webkit-filter: hue-rotate(0deg);
}
to {
-webkit-filter: hue-rotate(360deg);
}
}
.awesome {
font-family: futura;
font-style: italic;
color: #313131;
font-size: 45px;
font-weight: bold;
-webkit-background-clip: initial;
-webkit-text-fill-color: initial;
animation: colorchange 20s infinite alternate;
}
#keyframes colorchange {
0% {
color: blue;
}
10% {
color: #8e44ad;
}
20% {
color: #1abc9c;
}
30% {
color: #d35400;
}
40% {
color: blue;
}
50% {
color: #34495e;
}
60% {
color: blue;
}
70% {
color: #2980b9;
}
80% {
color: #f1c40f;
}
90% {
color: #2980b9;
}
100% {
color: pink;
}
}
<div class="container">
<h2 class="clr">नमस्ते</h2>
<h1 class="clr">Some Text <span class="awesome">HELLO</span> Some Text</h1>
</div>
Simply remove position absolute of .awesome
.container {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
/*background-color: red*/
}
.clr {
color: #f35626;
background-image: -webkit-linear-gradient(92deg,#f35626,#feab3a);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-animation: hue 30s infinite linear;
}
#-webkit-keyframes hue {
from {
-webkit-filter: hue-rotate(0deg);
}
to {
-webkit-filter: hue-rotate(360deg);
}
}
.awesome {
font-family: futura;
font-style: italic;
color:#313131;
font-size:45px;
font-weight: bold;
-webkit-animation:colorchange 20s infinite alternate;
}
#-webkit-keyframes colorchange {
0% {
color: blue;
}
10% {
color: #8e44ad;
}
20% {
color: #1abc9c;
}
30% {
color: #d35400;
}
40% {
color: blue;
}
50% {
color: #34495e;
}
60% {
color: blue;
}
70% {
color: #2980b9;
}
80% {
color: #f1c40f;
}
90% {
color: #2980b9;
}
100% {
color: pink;
}
}
<!DOCTYPE html>
<html><head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body class=""><div class="container"><br /><br /><center><b><h2 class="clr">नमस्ते</h2><br /><h1 class="clr">Some Text <span class="awesome">HELLO</span> Some Text</h1></b></center></div></body></html>
You have position:absolute; on your .awesome. If this is removed, you will see the text.
.awesome {
font-family: futura;
font-style: italic;
color:#313131;
font-size:45px;
font-weight: bold;
-webkit-animation:colorchange 20s infinite alternate;
}
Replace this In this I removed Position:absolute;
I need to have span with text aligned in the center.
Previously I have used line-height for this purpose, but in this case the text for some items are longer and this doesn't work any more.
JSFiddle: http://jsfiddle.net/4jSdu/
HTML:
<ul>
<li><a><span>Short</span></a>
</li>
<li><a><span>Why Should I Monitor?</span></a>
</li>
</ul>
CSS:
ul {
position: relative;
overflow: hidden;
}
span {
background-color: rgba(216, 25, 11, 0.75);
display: block;
height: 70px;
line-height: 70px;
width: 135px;
color: black;
text-align: center;
/*margin: auto 0;*/
font-weight: bold;
font-size: 15px;
position: absolute;
bottom: 14px;
}
li, a {
width: 135px;
height: 100px;
display: inline-block;
}
EDIT:
I want to note that span element has value bottom: 14px. THere is also animate effect on this span. when page loads span has value bottom: -70px (container has overlfow: hidden,s o this span is not seen) and then it appears (using .animate) and goes to bottom: 14px. So the sollution should consider this.
I cannot get this animate effect working in jsfiddle (http://jsfiddle.net/pr5cL/), but it works on my page that is locally created.
$("ul li:not(.img_active)").mouseenter(function() {
$(this).find("span").css("bottom","-55px");
$(this).find("span").animate({bottom:15},500);
}).mouseleave(function(){
$(this).find("span").animate({bottom:-70},500);
});
Here is link: http://www.sheerdigitaltest.net/janus/
Something like this maybe?
span {
display: inline-block;
line-height:1.25;
vertical-align:middle;
width: 135px;
color: black;
text-align: center;
font-weight: bold;
font-size: 15px;
}
a {
background-color: rgba(216, 25, 11, 0.75);
height: 70px;
line-height: 70px;
font-size:0;
overflow:hidden;
}
li, a {
width: 135px;
display: inline-block;
vertical-align:top;
}
span {
-webkit-animation: slidein 2s ; /* Safari 4+ */
-moz-animation: slidein 2s ; /* Fx 5+ */
-o-animation: slidein 2s ; /* Opera 12+ */
animation: slidein 2s ; /* IE 10+ */
}
#-webkit-keyframes slidein {
0% { margin-top: 70px; }
100% { margin-top: 0; }
}
#-moz-keyframes slidein {
0% { margin-top: 70px; }
100% { margin-top: 0; }
}
#-o-keyframes slidein {
0% { margin-top: 70px; }
100% { margin-top: 0; }
}
#keyframes slidein {
0% { margin-top: 70px; }
100% { margin-top: 0; }
}
Jsfiddle
No IE7 or earlier support. Animation support as per comments.