How To Add Animated Pictures To Your Blog
Adding subtle animations to your website is a great style to keep visitors engaged with your content.
Just similar in PowerPoint or Keynote, animations can exist used to focus visitors attention on what's important.
Unfortunately, for about website owners, adding animations isn't as like shooting fish in a barrel equally selecting them from a dropdown menu.
In this article, we'll walk you through the easiest means to add pop animations to your website.
Note: because websites are congenital on diverse platforms that handle code differently, we'll introduce the well-nigh universal arroyo using Breathing.css and and so explain a uncomplicated culling using PageCloud, where no code is required.
What are CSS animations?
As you lot may or may non know, CSS stands for Cascading Style Sheets. CSS is used by Spider web browsers to determine how the HTML elements on your page are displayed.
CSS animations enable your content to visually transition from one fashion configuration to another. For beginners that lack experience writing code, this can exist pretty intimidating.
Here's a simplified instance where text moves across the page using HTML and CSS:
Hello!
h3 { | |
blitheness-duration : 8southward ; | |
animation-name : slidein; | |
blitheness-iteration-count : infinite; | |
} | |
@keyframes slidein { | |
0% { | |
margin-left : 0% ; | |
} | |
fifty% { | |
margin-left : 300px ; | |
} | |
100% { | |
margin-left : 0% ; | |
} | |
} |
h3 { | |
animation-duration : 8due south ; | |
animation-name : slidein; | |
animation-iteration-count : space; | |
} | |
@keyframes slidein { | |
0% { | |
margin-left : 0% ; | |
} | |
50% { | |
margin-left : 300px ; | |
} | |
100% { | |
margin-left : 0% ; | |
} | |
} |
h3 { | |
blitheness-duration : 8southward ; | |
blitheness-name : slidein; | |
animation-iteration-count : space; | |
} | |
@keyframes slidein { | |
0% { | |
margin-left : 0% ; | |
} | |
50% { | |
margin-left : 300px ; | |
} | |
100% { | |
margin-left : 0% ; | |
} | |
} |
h3 { | |
animation-duration : 8s ; | |
animation-name : slidein; | |
animation-iteration-count : space; | |
} | |
@keyframes slidein { | |
0% { | |
margin-left : 0% ; | |
} | |
50% { | |
margin-left : 300px ; | |
} | |
100% { | |
margin-left : 0% ; | |
} | |
} |
h3 { | |
animation-elapsing : 8s ; | |
animation-name : slidein; | |
blitheness-iteration-count : space; | |
} | |
@keyframes slidein { | |
0% { | |
margin-left : 0% ; | |
} | |
50% { | |
margin-left : 300px ; | |
} | |
100% { | |
margin-left : 0% ; | |
} | |
} |
h3 { | |
blitheness-duration : viiis ; | |
blitheness-name : slidein; | |
animation-iteration-count : infinite; | |
} | |
@keyframes slidein { | |
0% { | |
margin-left : 0% ; | |
} | |
50% { | |
margin-left : 300px ; | |
} | |
100% { | |
margin-left : 0% ; | |
} | |
} |
h3 { | |
blitheness-elapsing : eightdue south ; | |
animation-proper noun : slidein; | |
blitheness-iteration-count : infinite; | |
} | |
@keyframes slidein { | |
0% { | |
margin-left : 0% ; | |
} | |
50% { | |
margin-left : 300px ; | |
} | |
100% { | |
margin-left : 0% ; | |
} | |
} |
When y'all read the CSS, you can encounter:
- Total duration of the animation is viii seconds (line ii).
- Animation existence used is "slidein" (line 3).
- Animation is on an space loop (line four).
- "Slidein" begins on the left hand side of the page (line 9).
- At one-half the duration, the title is 300px off the left side of the page (line 12).
- At the end of the animation, the text is dorsum on the left hand side of the folio (line 15).
If you'd like to try writing some CSS, you tin modify the case above using CodePen.
Equally you explore CSS animations, you volition discover dozens of properties that will enable you lot to customize your transitions so they work seamlessly inside your blueprint.
On the other manus, if you want to save time by using pre-built animations, you lot will want to apply Breathing.css.
What is Animate.css?
Animate.css is a cross-browser library of CSS animations created by Daniel Eden. As of 2019, the library contains 77 pre-congenital animations enabling you to chop-chop animate the content on your website.
Hither's an example of the lawmaking written past Daniel Eden for a "SlideInLeft" animation found within the stylesheet:
@-webkit-keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0 , 0); | |
transform : translate3d(-100% , 0 , 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0 , 0 , 0); | |
transform : translate3d(0 , 0 , 0); | |
} | |
} | |
@keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0 , 0); | |
transform : translate3d(-100% , 0 , 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0 , 0 , 0); | |
transform : translate3d(0 , 0 , 0); | |
} | |
} |
@-webkit-keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0, 0); | |
transform : translate3d(-100% , 0, 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0, 0, 0); | |
transform : translate3d(0, 0, 0); | |
} | |
} | |
@keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0, 0); | |
transform : translate3d(-100% , 0, 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0, 0, 0); | |
transform : translate3d(0, 0, 0); | |
} | |
} |
@-webkit-keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0, 0); | |
transform : translate3d(-100% , 0, 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0, 0, 0); | |
transform : translate3d(0, 0, 0); | |
} | |
} | |
@keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0, 0); | |
transform : translate3d(-100% , 0, 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0, 0, 0); | |
transform : translate3d(0, 0, 0); | |
} | |
} |
@-webkit-keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0, 0); | |
transform : translate3d(-100% , 0, 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0, 0, 0); | |
transform : translate3d(0, 0, 0); | |
} | |
} | |
@keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0, 0); | |
transform : translate3d(-100% , 0, 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0, 0, 0); | |
transform : translate3d(0, 0, 0); | |
} | |
} |
@-webkit-keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0, 0); | |
transform : translate3d(-100% , 0, 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0, 0, 0); | |
transform : translate3d(0, 0, 0); | |
} | |
} | |
@keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0, 0); | |
transform : translate3d(-100% , 0, 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0, 0, 0); | |
transform : translate3d(0, 0, 0); | |
} | |
} |
@-webkit-keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0, 0); | |
transform : translate3d(-100% , 0, 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0, 0, 0); | |
transform : translate3d(0, 0, 0); | |
} | |
} | |
@keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0, 0); | |
transform : translate3d(-100% , 0, 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0, 0, 0); | |
transform : translate3d(0, 0, 0); | |
} | |
} |
@-webkit-keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0, 0); | |
transform : translate3d(-100% , 0, 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0, 0, 0); | |
transform : translate3d(0, 0, 0); | |
} | |
} | |
@keyframes slideInLeft { | |
from { | |
-webkit-transform : translate3d(-100% , 0, 0); | |
transform : translate3d(-100% , 0, 0); | |
visibility : visible; | |
} | |
to { | |
-webkit-transform : translate3d(0, 0, 0); | |
transform : translate3d(0, 0, 0); | |
} | |
} |
By using this library, you tin can avoid spending hours writing and fine tuning simple animations. The all-time function? The library is open source and free to use!
How to use Animate.css in standard spider web evolution
Stride ane. Install or upload the Animate.css stylesheet to your file manager. This volition vary based on the platform you apply. Alternatively, you can use the Content Commitment Network (CDN) version to avoid uploading files to your web server.
Step 2. Link the Animate.css stylesheet in the of your web folio(s) or template. Eg:
<!-- Manually uploaded CSS file. --> | |
< head > | |
< link rel="stylesheet" href="animate.min.css"> | |
</ caput > | |
<!-- CDN version of Breathing.css --> | |
< caput > | |
< link rel="stylesheet"href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css"> | |
</ caput > |
<!-- Manually uploaded CSS file. --> | |
<head> | |
<link rel= "stylesheet" href= "animate.min.css" > | |
</head> | |
<!-- CDN version of Breathing.css --> | |
<head> | |
<link rel= "stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/breathing.css/3.seven.0/breathing.min.css" > | |
</head> |
<!-- Manually uploaded CSS file. --> | |
<head> | |
<link rel= "stylesheet" href= "animate.min.css" > | |
</head> | |
<!-- CDN version of Animate.css --> | |
<head> | |
<link rel= "stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css" > | |
</head> |
<!-- Manually uploaded CSS file. --> | |
<head> | |
<link rel= "stylesheet" href= "animate.min.css" > | |
</caput> | |
<!-- CDN version of Animate.css --> | |
<head> | |
<link rel= "stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.vii.0/breathing.min.css" > | |
</head> |
<!-- Manually uploaded CSS file. --> | |
<head> | |
<link rel= "stylesheet" href= "animate.min.css" > | |
</head> | |
<!-- CDN version of Breathing.css --> | |
<caput> | |
<link rel= "stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css" > | |
</head> |
<!-- Manually uploaded CSS file. --> | |
<caput> | |
<link rel= "stylesheet" href= "animate.min.css" > | |
</head> | |
<!-- CDN version of Animate.css --> | |
<caput> | |
<link rel= "stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css" > | |
</head> |
<!-- Manually uploaded CSS file. --> | |
<head> | |
<link rel= "stylesheet" href= "animate.min.css" > | |
</head> | |
<!-- CDN version of Animate.css --> | |
<head> | |
<link rel= "stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/animate.css/three.7.0/breathing.min.css" > | |
</caput> |
Step three. Add the proper course name to your chemical element
You must include "blithe" earlier the proper name of the animation. Y'all can also include the course "infinite" in society for your animation to loop indefinitely.
For example:
<h1 class= "animated infinite bounce filibuster-2s" >Hello!</h1> |
<h1 class= "animated infinite bounciness filibuster-2s" >Howdy!</h1> |
<h1 class= "animated space bounce filibuster-2s" >Hello!</h1> |
<h1 grade= "animated infinite bounce delay-2s" >Hello!</h1> |
<h1 class= "animated space bounciness filibuster-2s" >Hello!</h1> |
<h1 form= "animated space bounce delay-2s" >Hullo!</h1> |
In one case you lot get comfortable with CSS, you tin modify whatsoever of the properties plant in the stylesheet to match your ain unique preferences.
If you want a specific element to be different than the default animation, you can add modifiers to modify backdrop such as the duration, the delay or the number of times an animation volition play:
For case:
.elementNAME { | |
animation-duration : threesouth ; | |
blitheness-delay : twos ; | |
animation-iteration-count : infinite; | |
} |
.elementNAME { | |
animation-elapsing : 3s ; | |
animation-delay : 2s ; | |
blitheness-iteration-count : infinite; | |
} |
.elementNAME { | |
blitheness-duration : iiisouthward ; | |
animation-filibuster : 2s ; | |
animation-iteration-count : infinite; | |
} |
.elementNAME { | |
animation-duration : threedue south ; | |
animation-delay : 2s ; | |
animation-iteration-count : infinite; | |
} |
.elementNAME { | |
animation-elapsing : 3s ; | |
blitheness-delay : 2s ; | |
blitheness-iteration-count : infinite; | |
} |
.elementNAME { | |
animation-duration : 3due south ; | |
animation-delay : 2southward ; | |
animation-iteration-count : infinite; | |
} |
And that'south it!
By post-obit the steps in a higher place, you lot can add animations to any chemical element on any website where you accept access to the source lawmaking.
To larn more near custom CSS animations and what tin can be done with Javascript, we'd recommend taking a look w3schools and GitHub.
However, if web development isn't your forte, there are simpler alternatives like PageCloud where you don't demand to deal with the code at all.
We'd definitely recommend giving it a attempt if y'all're new to building websites.
Method 1
Footstep 1 - Download the Animate.css file from here;
Footstep 2 - Login to PageCloud and open up the folio you want to edit;
Footstep 3 - Drag and drop the "Animate.css" file you downloaded on to your page;
Footstep 4 - Select the element yous want to breathing and click on "Advanced" in the editing menu;
Stride 5 - Add "animated" + the proper noun of the desired animation (eg. blithe bounce);
Footstep half dozen - Save and view your live website.
Method two
Step 1 - Login to PageCloud and open up the page you want to edit;
Step two - Elevate the "On scroll animation file" on to your page;
Pace 3 - Select the chemical element you want to breathing and click on "Advanced" in the editing card;
Step 4 - Add the name of the desired blitheness to the class field;
Footstep 5 - Save and view your live website.
And voila! You're done.
Pro tip: Clever use of animations tin elevate just most any design. All the same, as well many animations can be distracting and plow off potential customers. When in doubt, less is more. If you lot want to get really skillful at animations, nosotros'd recommend checking out the Animation Handbook.
Summary
Regardless of your feel with CSS, following the instructions in this article volition give you the ability to add stunning animations to any website.
All the same, animations are only one of the many CSS properties used past websites in guild to display stunning content. Simply about every element on your website will need some CSS in order to look right: text, backgrounds, images, videos...
If you don't desire to spend days learning or fiddling with lawmaking, we'd recommend trying a website architect like Pagecloud that offers a convenient interface enabling you to animate and customize the look of your site without writing a unmarried line of lawmaking.
Best of all, Pagecloud offers a earth-form support team that will be happy to answer whatsoever of your questions, create your free website today!
Source: https://www.pagecloud.com/blog/css-animations
Posted by: vallierekeisheiled.blogspot.com
0 Response to "How To Add Animated Pictures To Your Blog"
Post a Comment