Top After Effects Text Hand-Written Animation Templates. With Envato Elements templates, you have tons of professional and creative design options, plus, stacked with pro design features, and great visuals to choose from, they're also quick and easy to work with.
- I'm trying to create a CSS button and add an icon to it using:after, but the image never shows up. If I replace the 'background' property with 'background-color:red' then a red box appears so I'm not sure what's wrong here.
- Dolly Parton’s Stampede is an extraordinary dinner show with thirty-two magnificent horses and a cast of top-notch riders. They will thrill you with daring feats of trick riding and competition, in a friendly and fun rivalry. You will enjoy a barrel full of music, dancing, special effects and family-friendly comedy along the way.
Websites are looking more and more like mobile apps. Users are also increasingly expecting a more app-like experience. From push notifications to offline mode, native web apps are getting there.
Once web apps function like native apps, the design interactions would also change to address the use case — namely, the ubiquity of animations. Animations drive interactions in all of our favourite apps, from Uber to Lyft and Snapchat to Instagram.
Practical Techniques On Designing Animation
What happens when a button has been activated? Does the user have to wait, not knowing if the form worked? A button with a loader could keep the viewer engaged while data is loaded in the background. Read a related article →
As web developers, we need a good foundation to create animations that are both performant and maintainable, which is paramount to the native web app landscape. We need to be able to go from After Effects to CSS transitions, animations and keyframes.
What Is After Effects?
After Effects is an industry-standard product from Adobe used by graphic and motion designers to key, compose and track animations. It is the de facto tool used by many designers to communicate ideas to a team by exporting the animation layers into an easy-to-visualize sample video, with a reference table of the animation start and end times to accompany it.
Together, the demo video and the reference table give the development team a good baseline for how to implement the animation. The video is used to see the overall picture, while the reference table provides the minute details that make or break the animation interaction.
Things We Can Do With After Effects
What we can create with After Effects is limited only by our imagination. It can provide an endless number of post-production effects for an image or video. In the scope of the web, it provides a platform for ideas to be shared.
Consider the red ball above. The ball is animated using After Effects to slowly roll to the middle, pause for a second, and then slowly accelerate to exit the viewport. The classic web animations of movement, scaling, rotation and even color change are easily done in After Effects and serve as an instantly generated requirements document (or video or GIF) for the animations to be implemented.
Tools You Need To Get Started
CSS transitions provide a way to control how fast a change in CSS property is applied to an element. Instead of applying a style immediately (without transitions), it could be applied gradually over a defined acceleration curve using customization rules. An example would be changing a background color from black to white over a period of time.
With this rule on the element, the background color would take three seconds to change, gradually changing from black to white, going through shades of gray. This can further be customized by adding transition-timing-function, to calculate intermediate values, and transition-delay, to delay the start of the animation.
CSS transitions are good for simple interactions, such as changing the background color or moving an element to a new location.
Using CSS Animations
CSS animations provide even finer control over the intermediate steps between an animation, using waypoints. Waypoints (or keyframes) are pinned points in time, during the animation, when we apply certain styles to an element. We then use the defined keyframes to lay out what the animation should look like.
Suppose we want an element to animate as a bounce. The element needs to move up, move back to the original position, move back up a little, and then move back to the original position. Using keyframes, we can break down that elastic effect into percentages of time that the animation will take.
After Effects To Css Convert
As with CSS transitions, there are plenty of options for developers to configure. We can make animations repeat indefinitely using
animation-iteration-count, with the value
infinite, or even control the direction in which the animation flows, using the property
animation-direction. Plenty of CSS animation properties give us fine-grained control to match an animation to the design.
CSS animations are useful for short repeating animations, such as expansion, rotation and bounces.
An example is the simple addition of an
When the timeout (of
500ms) expires, a class of
active is added to the ball
div, which changes the
transform property, which then triggers the
transition property, which is watching the
Imagine we had a task in which we had to animate an element on the page. Let’s make this element a red ball. The ball would have to rotate around the page, as well as scale up and down.
After Effects allows us to create mockups of what the interaction would look like when the animation is triggered. The ball in motion below is an example of that. Notice how the red ball first slightly scales up, then begins accelerating around a circular loop and decelerates back into its original position. Only then does the ball scale down to its original size.
Consider the shift in scale above where the ball grows or shrinks before moving or stopping. This is a tiny feature that the designer has crafted in After Effects and needs to be communicated to the developer clearly so that the minute details are not missed.
That is why some preparation would need to be done before going from After Effects to the developer. We couldn’t simply create a video file of the animation in action, share it with the developer and call it a day.
One way to convey our ideas clearly is to create a spreadsheet detailing the steps needed for the animation. Depending on the complexity of the animation, it could be simple scribbles on a ticket, a text file containing a list or a full-blown spreadsheet.
|1||Ball scales up||1 second||Scale 1.25 with shadow|
|2||Ball moves in a circle||2 seconds||Scale 1.25 with a radius of 25 pixels|
|3||Ball scales down||1 second||Scale back to 1|
Another way to convey information about the animation is to embed it in the video itself. You can do this right in After Effects, adding crucial information such as how much to scale, the number of steps and other information as it is happening, to give context to the implementer. This enables us to use the demo video as a universal source of truth.
1. Break Down The Animation
Look for patterns and note the timings.
The first thing to do is draw the timeline of the animations for each of the elements (or group of elements). We need to understand where animations intersect in order to synchronize the timing and animation lifecycle around them. Planning is key to a complex animation, so that we can incrementally build our solution in a maintainable way for future requirements.
From the information above, we break it down as the following steps:
- Initialize the component and wait for a trigger.
- Once triggered, scale up in size and expand the drop shadow.
- After that, move around in a circle with
- Then, scale down in size and decrease the drop shadow.
The benefit of outlining is that we understand which components must live outside of the animating elements — for example, the drop shadow must be independent of the ball. Similar to outlining an essay, breaking down the animation organizes our thoughts on the work we have to do. Outlines demonstrate the thinking process behind an animation and doubly serves as documentation for our work.
2. Negotiate With Stakeholders
Can we simplify some areas? Which parts of the animation are a must? Can we synchronize timings?
Once we have investigated the work needed to accomplish the task, we bargain. Bargaining with the designer and the product owner is every developer’s responsibility. The implementer has a complete understanding of the key low-hanging fruit, what can be done and what is not practical to do.
Animation is tricky because removing seemingly minute details from an animation could change the user experience. To give a development-based example, changing how an animation behaves is akin to changing the response payload we might receive from an API call: Certain things could be changed, but some parts must be there.
This is a case-by-case situation, based on our relationship with the designer, as well as with the product owner given the timeline for launching. Asking for certain animations to be removed is not recommended because this would be beyond our area of expertise.
3. Plan The Attack
Let’s examine the animation described earlier. Five states jump out at us:
- the initial state, with the red ball and some drop shadow;
- the scaled-up version of the ball with a longer drop shadow;
- the movement of the ball around a circle;
- scaling down of the ball, along with its drop shadow;
- the return to the initial state, waiting to be triggered.
For all five states, we should look at what the style is before and what it should be after. This will provide us with information on what kind of animation tools we would need in order to implement it.
To do this, we start with the base case style. This could be nothing, if the element appears out of nowhere, or it could be the previous style, in the case of chained animations.
|State||Class names||Duration||Animation timing|
|1||ball||(n/a, waiting for trigger)||n/a|
|2||ball, ball--scale-up||1 second||ease-out|
|3||ball, ball--scale-up, ball--circling||2 second||ease-in-out|
|4||ball, ball-scale-up, ball--circling, ball--scale-down||1 second||ease-in|
|5||ball||(n/a, waiting for trigger)||n/a|
BEM CSS is ideal for our naming strategy because of how we would represent the states of our animations in progress with modifiers. If the animation is generic enough, BEM is also a good methodology to maintain DRY (“don’t repeat yourself”) CSS classes that work across code bases. We’d start off with just the block and element markers and then layer in modifiers as we progress through the animation.
Here is a sample template class journey:
We start off with the container element with the class ball, which would represent the red ball we are animating. As the animation iterates across the experience, so too do our BEM class names, from scaling up to moving in a circle. This is a method to keep track of what the element is supposed to look like when the styles are applied.
4. Steady Implementation
With an outline on hand and tools ready to use, we should chip away at the project state by state.
We can iteratively tackle each state as a separate item, building upon the previous state as needed. With each state clearly defined, we can focus more on making our code DRY and easy to read, rather than on details of implementation. And, of course, it would be nice to add tests to cover our logic.
We start with a simple red ball, with a slight drop shadow.
There are two parts to scaling up: the size of the element and its drop shadow. We use a keyframe, named
scale, that is shared by both the scaling up and down for DRY-ness to handle this animation.
Circling (After Scaling-Up Animation Is Applied)
We use a keyframe, named
circular, as well as move its
transform-origin property to move the element around in a circle, starting from the beginning. Keep in mind that circling only happens when the scaling-up animation has completed.
Scaling Down (After Circling and Scaling-Up Animations Are Applied)
To scale down, we reuse the keyframe scale, with
animation-direction: reverse to do the opposite of what the scale-up class does. This brings us back to our original state.
If we combine all of these classes into a sequence, we would have a CSS representation of the rendering done in After Effects.
Click on the ball to start.
See the Pen Animating Ball by Chris Ng (@chrisrng) on CodePen.
The tools covered in this article are hardly cutting-edge, but they are generally supported across most major browsers, which makes them usable today.
Previously, implementing animations was hard because it meant using external tools such as jQuery Animate to do simple things such as moving elements around on the page. Today, CSS transitions and animations can be done natively and efficiently, leveraging the GPU.
Animations are always a tug of war between developer, designer and product owner. The trick is to find the middle ground, where all stakeholders are happy with the quality of the product. Hopefully, this guide will help you make that transition.
This tutorial is about making your JavaFX application look attractive by adding a Cascading Style Sheet (CSS). You develop a design, create a
.css file, and apply the new styles.
In this tutorial, you will take a Login form that uses default styles for labels, buttons, and background color, and, with a few simple CSS modifications, turn it into a stylized application, as shown in Figure 3-1.
Figure 3-1 Login Form With and Without CSS
Description of 'Figure 3-1 Login Form With and Without CSS'
The tool used in this Getting Started tutorial is NetBeans IDE. Before you begin, ensure that the version of NetBeans IDE that you are using supports JavaFX 2. See the System Requirements for details.
Create the Project
If you followed the Getting Started guide from the start, then you already created the Login project required for this tutorial. If not, download the Login project by right-clicking Login.zip and saving it to your file system. Extract the files from the zip file, and then open the project in NetBeans IDE.
Create the CSS File
Your first task is to create a new CSS file and save it in the same directory as the main class of your application. After that, you must make the JavaFX application aware of the newly added Cascading Style Sheet.
In the NetBeans IDE Projects window, expand the Login project node and then the Source Packages directory node.
Right-click the login folder under the Source Packages directory and choose New, then Other.
In the New File dialog box, choose Other, then Cascading Style Sheet, and click Next.
Enter Login for the File Name text field and ensure the Folder text field value is
Login.javafile, initialize the
style sheetsvariable of the
Sceneclass to point to the Cascading Style Sheet by including the line of code shown in bold below so that it appears as shown in Example 3-1.
This code looks for the style sheet in the
srclogindirectory in the NetBeans project.
Add a Background Image
A background image helps make your form more attractive. For this tutorial, you add a gray background with a linen-like texture.
First, download the background image by right-clicking background.jpg and saving it to your file system. Then, copy the file into the
srclogin folder in the Login NetBeans project.
Now, add the code for the
background-image property to the CSS file. Remember that the path is relative to the style sheet. So, in the code in Example 3-2, the
background.jpg image is in the same directory as the
The background image is applied to the
.root style, which means it is applied to the root node of the
Scene instance. The style definition consists of the name of the property (
-fx-background-image) and the value for the property (
Figure 3-2 shows the login form with the new gray background.
Figure 3-2 Gray Linen Background
Description of 'Figure 3-2 Gray Linen Background'
Style the Labels
The next controls to enhance are the labels. You will use the
.label style class, which means the styles will affect all labels in the form. The code is in Example 3-3.
Example 3-3 Font Size, Fill, Weight, and Effect on Labels
This example increases the font size and weight and applies a drop shadow of a gray color (#333333). The purpose of the drop shadow is to add contrast between the dark gray text and the light gray background. See the section on effects in the JavaFX CSS Reference Guide for details on the parameters of the drop shadow property.
The enhanced User Name and Password labels are shown in Figure 3-3.
Figure 3-3 Bigger, Bolder Labels with Drop Shadow
Description of 'Figure 3-3 Bigger, Bolder Labels with Drop Shadow'
Now, create some special effects on the two
Text objects in the form:
scenetitle, which includes the text
actiontarget, which is the text that is returned when the user presses the Sign in button. You can apply different styles to
Text objects used in such diverse ways.
Login.javafile, remove the following lines of code that define the inline styles currently set for the text objects:
scenetitle.setFont(Font.font(“Tahoma”, FontWeight.NORMAL, 20));
By switching to CSS over inline styles, you separate the design from the content. This approach makes it easier for a designer to have control over the style without having to modify content.
Create an ID for each text node by using the
setID()method of the Node class:
Burp Suite Community Edition is a feature-limited set of manual tools for exploring web security. Proxy your HTTPS traffic, edit and repeat requests, decode data, and more. Get the latest version here. Alternatively, try hacking like the pros do - with a free trial of Burp Suite Professional. Burp free.
Login.cssfile, define the style properties for the
actiontargetIDs. For the style name, use the ID preceded by a number sign (#), as shown in Example 3-4.
The size of the Welcome text is increased to 32 points and the font is changed to Arial Black. The text fill color is set to a dark gray color (#818181) and an inner shadow effect is applied, creating an embossing effect. You can apply an inner shadow to any color by changing the text fill color to be a darker version of the background. See the section on effects in the JavaFX CSS Reference Guide for details about the parameters of inner shadow property.
The style definition for
actiontarget is similar to what you have seen before.
Figure 3-4 shows the font changes and shadow effects on the two
Figure 3-4 Text with Shadow Effects
Description of 'Figure 3-4 Text with Shadow Effects'
Style the Button
The next step is to style the button, making it change style when the user hovers the mouse over it. This change will give users an indication that the button is interactive, a standard design practice.
First, create the style for the initial state of the button by adding the code in Example 3-5. This code uses the
.button style class selector, such that if you add a button to the form at a later date, then the new button will also use this style.
Now, create a slightly different look for when the user hovers the mouse over the button. You do this with the hover pseudo-class. A pseudo-class includes the selector for the class and the name for the state separated by a colon (:), as shown in Example 3-6.
After Effects To Css Free
Example 3-6 Button Hover Style
Figure 3-5 shows the initial and hover states of the button with its new blue-gray background and white bold text.
Figure 3-5 Initial and Hover Button States
Description of 'Figure 3-5 Initial and Hover Button States'
After Effects To Css Format
Figure 3-6 shows the final application.
Figure 3-6 Final Stylized Application
Description of 'Figure 3-6 Final Stylized Application'
Where to Go from Here
After Effects To Css3
Here are some things for you to try next:
Css After Hr
See what you can create using CSS. Some documents that can help you are Skinning JavaFX Applications with CSS, Styling Charts with CSS, and the JavaFX CSS Reference Guide. Skinning with CSS and CSS Analyzer also provides information on how you can use the JavaFX Scene Builder tool to skin your JavaFX FXML layout.
See Styling FX Buttons with CSS for examples of how to create common button styles using CSS.
Try deploying your application outside NetBeans IDE. See Deploying Your First JavaFX Application.