"Editor's note" This article is from smashing Magazine, the author of Brolik co-founder, chief creative officer Drew Thomas. This paper introduces the advantages of adding dynamic design to the web, and some suggestions for dynamic design, such as using layer technology, transition before and after application and developing single page application. He also demonstrates the way in which dynamic design is implemented by CSS3 code demonstrations. The following is a brief translation of the text.
Digital experiences are increasingly focused on the simulation of reality and are progressing every day. In particular, the simulation of the physical world is used more and more widely, and the distance between man and machine is shortened further.
Web-Dynamic past
Flash once had a glorious history, that is the era of network video just rise. But later people found that a lot of content is actually ineffective, slow, redundant, flash gradually went downhill. Then the advent of JS and jquery, the realization of a larger breakthrough, but the use is not very convenient. With the advent of CSS3 animations and the further improvement in performance of hardware devices, designers can now freely write interesting interactive pages or apps through cascading style sheets.
the future of Web dynamic
Dynamic pages and dynamic apps have brought endless joy to people's lives, so what are some of the technologies that deserve attention?
Layers (layer)
Layer technology can be said to be the most widely used technology, which is reflected in the iOS7 of the most vividly. For example, a control center that slides up from the bottom of the screen will overwrite the current part of the screen. (See video demos on this website)
The important thing about layers is that the designer can hide the information and quickly display it where it needs to be displayed, thus avoiding the inefficient rendering of the whole picture, while allowing the user to buffer the front and back of the transition without feeling too abrupt.
Context (pre-and post-transition)
Here's a Instacart IOS app to illustrate the importance of the transition. See the GIF demo on the site, where the item images are moved from their current location to a new location, and the details are displayed below. This kind of display conforms to the natural law, makes the person feel the transition nature.
Another example is a drop-down menu that displays the entire menu list after clicking on a cascade image. Otherwise, if the entire screen is suddenly filled with menu items, the user experience is very bad. Gmail and Facebook apps are a leader in pull-down technology applications, so let's go inside.
SPA (Single page application)
When we add motion and scene transitions to the user interface, the next step is how to control them to make it a whole. In order to achieve a better page-to-page transition, a single page application came into being.
For example, I am writing a Web site: http://app.danceityourself.com, the inside of the login and logout operation is used to the spa. Inside use JS to add an action class to the login page, triggering the CSS transition animation.
The benefit of the SPA is that the transition is natural, efficient, and logical; It makes users feel like they're accessing something that's not like a typical website, but rather a local app.
How to use CSS actions
Everything starts hard, and my advice is to start with the basics, rather than writing overly complex and fancy pages in one go.
CSS Transitions
In the real world, the transformation between things is a certain transition. Conversely, no transition can be too sudden.
Let's look at this code first:
CSS Code
- button {
- Margin-left:0;
- }
- Button:hover {
- margin-left:10px;
- }
It means that when the cursor crosses a button, the button moves 10 pixels to the right. But there is no transition, which gives the impression that it is instantaneous and not quite in accordance with the law of nature. Full Demo Click here to view, browser prefix and other content is necessary, but the following example contains only the core action code, the following no longer described.
Next look at the effect of adding transition animations, the demo link:
CSS Code
- button {
- Margin-left:0;
- Transition:margin-left 1s;
- }
- Button:hover {
- margin-left:10px;
- }
Add the Ease-out keyword, turn on the slow-motion function, this looks more comfortable, because the brain for moving objects will have a certain delay (residual effect), adding a delay transition animation can make the brain and moving object motion synchronization, thus feeling that this is true. For more information about the properties of CSS transition animations, please click here for a review.
CSS Animations
CSS animations are relatively slightly more complex than the scene transitions. When will it be applied to? Typically, you animate the page elements that you want to be noticed by the user.
Take a look at the following example of CSS animation, the effect is to dynamically display a large shrinking circle.
CSS Code
- div.circle {
- Background:#000;
- Border-radius:50%;
- Animation:circlegrow 800ms ease-in-out Infinite Alternate both;
- }
- @keyframes Circlegrow {
- 0% {
- height:2px;
- width:2px;
- }
- 50% {
- height:40px;
- width:40px;
- }
- 100% {
- height:34px;
- width:34px;
- }
- }
The key frame animation is added to the circular object using CSS Keyframe technology.
The implementation process consists of two steps.
First, using the animation property, which is somewhat similar to the transition property, but can do more, animation detailed description Click here to check. Specifies the animation property for Circlegrow, which performs a looping animation every 800ms.
Second, keyframe. The speed of animation changes is controlled by setting a percentage value of 0 to 100. In the example, the key frame size of the object is set at 0%,50%,100%, and a dynamic transform effect is formed with the setting of step one.
For specific effects and complete sample code, click here to view.
The optional parameters that are included with the animation are as follows:
CSS Code
- Animation: [Animation name (from Keyframe Block)] [duration] [timing function] [delay] [number of times the animation Repe ATS] [Animation direction] [fill mode]
Please click here for more information.
key points for using CSS animations
Transitional Nature
To drive a car, the reality will not start instantly can reach 100 yards it? So the transition is very necessary.
It is recommended to try ease parameters, and compare the similarities and differences before and after adding. If you want to see more examples of transition (time) animations, please click here to view.
Reference and specific gravity
Typically, large items are heavier and slower than small items, so evaluate the page elements and then set the associated action and time values. As mentioned in the button movement example, a small button to move within 1s 10 pixels is indeed too slow, one-fourth seconds or less value will make people feel more natural.
written in the last
If you want to achieve more complex effects, you should do more hands-on, so that you can more appreciate the mystery. Only by standing in the user's perspective to think about the problem, and constantly reduce the distance between the reality and the machine, so as to make a better user experience.
A few tips to make your website and app more dynamic