Új üzenetek
Jelenlévő felhasználók
Info! Hozzászóláshoz jelentkezz be vagy regisztrálj!
vmarci21 2014.07.16 13:59
Giving Animations Life — Tictail Makers — Medium
if (window.top !== window.self) window.top.location = window.self.location.href;var OB_startTime = new Date().getTime(); var OB_fontLoaded = 0; var OB_loadErrors = []; function _onerror(e) { OB_loadErrors.push(e) }; if (document.addEventListener) document.addEventListener('error', _onerror, true); else if (document.attachEvent) document.attachEvent('onerror', _onerror); function _asyncScript(u) {var d = document, f = d.getElementsByTagName('script')[0], s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = u; f.parentNode.insertBefore(s, f);}function _asyncStyles(u) {var d = document, f = d.getElementsByTagName('script')[0], s = d.createElement('link'); s.rel = 'stylesheet'; s.href = u; f.parentNode.insertBefore(s, f);}(function() {var config = {kitId: "dta5koc", scriptTimeout: 3000, active: function(){window.requestAnimationFrame && window.requestAnimationFrame(function(){OB_fontLoaded = new Date().getTime(); window._onWebfontLoad&&window._onWebfontLoad();})}, inactive: function(){window._onWebfontError&&window._onWebfontError()}};var h=document.getElementsByTagName("html")[0];h.className+=" wf-loading";var t=setTimeout(function(){h.className=h.className.replace(/( |^)wf-loading( |$)/g,"");h.className+=" wf-inactive";window._onWebfontError&&window._onWebfontError()},config.scriptTimeout);var tk=document.createElement("script");tk.src='//use.typekit.net/'+config.kitId+'.js';tk.type="text/javascript";tk.async="true";tk.onload=tk.onreadystatechange=function(){var a=this.readyState;if(a&&a!="complete"&&a!="loaded")return;clearTimeout(t);try{Typekit.load(config)}catch(b){}};var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(tk,s)})();var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-24232453-2']); _gaq.push(['_trackPageview']); _asyncScript(('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js');var _kmq = _kmq || []; var _kmk = _kmk || '965ccfe7459a74a1209b1412b24fe962252de6b3'; _asyncScript('//i.kissmetrics.com/i.js'); _asyncScript('//doug1izaerwt3.cloudfront.net/' + _kmk + '.1.js');_asyncStyles('https://dnqgz544uhbo8.cloudfront.net/_/fp/css/main-sprites.bHy56f2tBKxt4HZt-XIMwA.css')HomesearchCollectionsSign in or create an accountMedium site navigationJoel Besada on Jun 247 minInfoHistoryCancelPublish changesDon’t write aloneCopy and send this draft link to anyone. They’ll be able to leave you notes before you publish.Featured postNext in trendingGiving Animations LifeUsing Bounce.js and classical animation concepts to bring life to user interfaces.  Joel Besada in Tictail Makers7 min readGiving Animations LifeUsing Bounce.js and classical animation concepts to bring life to user interfaces.  I love animations. That’s why I created Bounce.js, a tool (and soon to come) JavaScript library for generating beautiful CSS3 keyframe animations. In this post I want to show how you can use Bounce.js, and some concepts from classical animation, to bring life to your animations in your web apps. I’ll begin with a regular boring animation of Tictail’s signup form flying into view and advance step by step to create something more interesting. Note that each GIF also has a link to a higher quality video to better see the details.First Iteration — Default EaseView MP4This first version is just a regular, hand-written CSS3 keyframe animation with only two keys:.form { animation: form-fly-up 0.35s ease;}@keyframes form-fly-up { 0% { transform: translateY(500px); } 100% { transform: translateY(0); }}I’m using the default easing function, ease, which slightly slows down the movement before halting to an end. This is probably the simplest form of animation that you can create, and it doesn’t look all that great. The motion is very unnatural and feels robotic and stale.Second Iteration — Bounce BackView MP4To spruce things up a little, let’s add another key to our keyframes to make the signup form overshoot a small distance before settling in its final position:.form { animation: form-fly-up 0.45s ease;}@keyframes form-fly-up { 0% { transform: translateY(500px); } 50% { transform: translateY(-50px); } 100% { transform: translateY(0); }}This gives more of a “springy” feeling to the signup form, but it’s still a bit awkward. I could spend time on tweaking the values, or even adding in more back and forth bounces, but wouldn’t it just be better to have a computer calculate the keyframes for us based on a real physical model? That’s exactly what Bounce.js does!Third Iteration — Spring PhysicsView MP4Here I’ve used an animation generated by Bounce.js. It’s probably the most basic animation the tool can create, but it’s already feeling a lot better than before!.form { animation: form-fly-up 1s linear;}/* Generated with Bounce.js. Edit at http://goo.gl/AUAzKV */ @keyframes form-fly-up { …}I’m using the default bounce easing function, which is based on a simplified model of a mass-spring-damper system. Special thanks to Soroush Khanlou for his blog post explaining them and his iOS library, SKBounceAnimation, which has been to great help in creating the easing functions for Bounce.js.Now that we have the fly-in motion in place, let’s think about other ways to improve the animation even further. A good source of inspiration is animated cartoons, and the concepts and tricks that animators use to create them.Disney’s Twelve Basic Principles of Animation is a set of principles for producing more realistic animations based on the work of leading Disney animators during the golden age of animation. The principles were introduced in The Illusion of Life: Disney Animation, which has by some been referred to as the Bible of animation. Let’s examine them and see how we can apply some of the principles to our signup form here.Fourth Iteration — Follow Through and Overlapping ActionView MP4 (+ Slow Motion)Follow Through and Overlapping Action are two related techniques that help give the impression that animated characters or objects follow the laws of physics. In essence, they show that different parts of an object may move at different rates during motion, or continue moving after the motion of the main object has stopped.In the animation above, you’ll see a couple of frames of the button moving independently after the form has stopped. This gives the illusion of the button being a separate object with its own weight, rather than the entire form feeling like it’s just a flat, rigid paper card..form { animation: form-fly-up 1s linear;}.button { animation: button-bounce 1s 0.12s linear;}/* Generated with Bounce.js. Edit at http://goo.gl/TvjpS6 */@keyframes form-fly-up { …}/* Generated with Bounce.js. Edit at http://goo.gl/sNmGrx */@keyframes button-bounce { …}Note that the stiffness of the form-fly-up animation has been increased to give it a harder impact, which emphasises the motion of the button more.Fifth Iteration — Animation SmearView MP4 (+ Slow Motion)In this next iteration I’m stretching out the entire form while it’s moving (see the video in the caption for a slowed down version), to simulate a motion blur. This is called an animation smear and is not directly from Disney’s twelve principles, but is nonetheless a common and useful trick used in hand drawn animation to reduce the number of frames required to convey a motion. This tumblr blog is dedicated to collecting and displaying still frames of animation smears, and it really showcases the craftsmanship that can go into creating this effect.Note in the code below that we’ve changed the transform origin of the form to be at the top instead of the default center, so that it stretches away from the direction of the motion..form { transform-origin: 50% 0; animation: form-fly-up 1s linear;}.button { animation: button-bounce 1s 0.12s linear;}/* Generated with Bounce.js. Edit at http://goo.gl/dvi8wI */@keyframes form-fly-up { …}/* Generated with Bounce.js. Edit at http://goo.gl/sNmGrx */@keyframes button-bounce { …}Now, since our computer already does all of the drawing, my added smear doesn’t really serve the purpose I described above. However, smears can still be used for the artistic effect, or for the exaggeration of a motion, which is the reason for using it here. This actually leads us back to the twelve basic animation principles again, since exaggeration is one of them.Final Iteration — Squash and StretchView MP4 (+ Slow Motion)In this final iteration of the animation, I’ve used what is described to be “by far the most important” of Disney’s twelve principles — Squash and Stretch. This principle is used to give a sense of weight and flexibility to objects. A classic example of this is a bouncing ball compressing as it hits the ground and then extending as it bounces up again:Image by AutodeskTo get the desired effect on our signup form, it’s important to try to maintain the overall volume as it squashes together on its impact..form { transform-origin: 50% 0; animation: form-fly-up 1.29s linear;}.button { animation: button-bounce 1s 0.12s linear;}/* Generated with Bounce.js. Edit at http://goo.gl/G1h7Qa */@keyframes form-fly-up { …}/* Generated with Bounce.js. Edit at http://goo.gl/sNmGrx */@keyframes button-bounce { …}Now that we’ve reached the final version of the animation, I’m sure you’ll agree that I’ve made it look very cartoony, which might not necessarily be the look you are going for. Keep in mind however that I’ve opted for a more extreme portrayal of the different principles just to make the point clearer. All of the principles described above can be used in a more modest manner to get something that fits better with the rest your style.I think that we as user interface designers and developers have a lot to learn both from classical animation and physical models to make our animations feel better. I hope this post has been able to demonstrate the interesting things that can happen when both of those worlds are combined, and I’m excited to see all the projects that have come out lately that are simplifying the process of animating for the web. With the increased browser support for performant animations and more people starting to work with them more seriously, I would like to believe that we are about to enter the golden age of web animation.☺Thanks again to Soroush Khanlou for his wonderful work on SKBounceAnimation. Thanks also to Pasquale D’Silva (@pasql) for helping me improve some of the animations — If you haven’t already, you should totally check out his post Transitional Interfaces.RecommendWritten byJoel BesadaMaking stuff on the web, nowadays at @tictail.FollowPublished inTictail MakersThoughts on product development from the people of Tictail.Follow" alt="Image" class="uzenfalkeplink2"/>
https://medium.com/tictail-makers/giving-animations-life-8b20165224c5">if (window.top !== window.self) window.top.location = window.self.location.href;var OB_startTime = new Date().getTime(); var OB_fontLoaded = 0; var OB_loadErrors = []; function _onerror(e)
bykewix profilképe
bykewix 2014.07.16 14:18 Nem jó a description és az image
vmarci21 profilképe
vmarci21 2014.07.16 14:19 @bykewix: valahogy nekem is feltűnt... Image 
kovjonas profilképe
kovjonas 2014.07.16 14:23 Érdekes....a legtöbb helyen azt ajánlják, hogy CSS3 animációt használjunk, meg hogy az jó, de akkor mi van ezzel? Rendesen optimalizáltam, de valamelyik IE verzió alatt műxik, másiknál nem. :S Szóval semmi sem működhet mindegyik böngésző alatt egyszer már TÖKÉLETESEN?? Image
szerkesztve 2014.07.16 13:27-kor kovjonas által
szerkesztve 2014.07.16 13:38-kor kovjonas által
Válasz írása..