background preloader

RequestAnimationFrame for smart animating

RequestAnimationFrame for smart animating
If you’ve never written code to animate inside the browser, you can stop reading :) What is requestAnimationFrame? In your animation work, you’ve used a timer loop to make changes every few milliseconds. Good for us: browser vendors have decided, “hey, why don’t we just give you an API for that, because we can probably optimize some things for you.” Why should I use it? The browser can optimize concurrent animations together into a single reflow and repaint cycle, leading to higher fidelity animation. OMG I can brag about having a site with battery-friendly animations? Yeah bro. How should I use this? Note: I am using ‘requestAnimFrame` here because since the spec is still in flux, I don’t want to make a straight polyfill, yet. 2012.01.07: The spec has gotten some fixes and settled down. A robust polyfill Opera engineer Erik Möller wrote about rAF and developed a polyfill that better handles browsers without native support. I have this polyfill available as a gist as well. Is it ready?

sole/tween.js DomainByIP.com - Find websites hosted on the same IP-address Improving HTML5 Canvas Performance Introduction HTML5 canvas, which started as an experiment from Apple, is the most widely supported standard for 2D immediate mode graphics on the web. Many developers now rely on it for a wide variety of multimedia projects, visualizations, and games. However, as the applications we build increase in complexity, developers inadvertently hit the performance wall. There’s a lot of disconnected wisdom about optimizing canvas performance. Note that this article does not go into usage of HTML5 canvas. Performance testing To address the quickly changing world of HTML5 canvas, JSPerf (jsperf.com) tests verify that every proposed optimization still works. Visitors to a JSPerf performance test page can run the test on their browser, and let JSPerf store the normalized test results on Browserscope (browserscope.org). All of the performance results in this article are keyed on the browser version. Pre-render to an off-screen canvas no pre-rendering: pre-rendering: can2.width = 100; can2.height = 40;

jQuery: The Write Less, Do More, JavaScript Library method_exists() vs. is_callable() One thing I often see when re-factoring PHP applications, is the improper use of the method_exists() function, and I think this needs a little bit of clarification. Here is a typical example of what I’m talking about: The purpose of this code snippet is quite easy to understand (even if I don’t encourage to do this kind of not-very-OOP-stuff): having an object named “$object”, we try to know if it has a method named “SomeMethod”, if so, we call it, and provide some arguments to it. This code will probably run very well during all its lifetime, but what if the object’s method is not visible from the current scope (like… a private or protected method)? The real intent of the previous code snippet was in fact to know if the application could call a method on the object, from the current scope. This is why (among other reasons) is_callable() is part of the PHP built-in functions. Here is another snippet of code to illustrate the differences between method_exists() and is_callable() in action:

10 Rendering — HTML5 User agents are not required to present HTML documents in any particular way. However, this section provides a set of suggestions for rendering HTML documents that, if followed, are likely to lead to a user experience that closely resembles the experience intended by the documents' authors. So as to avoid confusion regarding the normativity of this section, RFC2119 terms have not been used. 10.1 Introduction In general, user agents are expected to support CSS, and many of the suggestions in this section are expressed in CSS terms. In the absence of style-layer rules to the contrary (e.g. author style sheets), user agents are expected to render an element so that it conveys to the user the meaning that the element represents, as described by this specification. The suggestions in this section generally assume a visual output medium with a resolution of 96dpi or greater, but HTML is intended to apply to multiple media (it is a media-independent language). An element is being rendered

Columnizer jQuery Plugin The Columnizer jQuery Plugin will automatically layout your content in newspaper column format. You can specify either column width or a static number of columns. And, of course, it’s easy to use! Get the source Available on Github at Stable Version: 1.6.0 Download It Here Quick Start To use columnizer, just call the columnize() function on your jQuery selection, and that’s it! Release Candidate New Features! Now you can manually specify line breaks for some or all of your columns! Stable Version New Features Stable Release Bug Fixes Columnizer is now backwards compatible with older versions of jQueryFixed `lastNeverTallest` sometimes leaving a tall last columnAdded a class to nodes that are split between columns. Demos Sample 1: Simple text only columns. Documentation Documentation is available on the Github repository’s wiki. Helpful Hints License Columnizer by Adam Wulf is licensed under a Creative Commons Attribution 3.0 United States License.

Conditional subpatterns It is possible to cause the matching process to obey a subpattern conditionally or to choose between two alternative subpatterns, depending on the result of an assertion, or whether a previous capturing subpattern matched or not. The two possible forms of conditional subpattern are (?(condition)yes-pattern) (? If the condition is satisfied, the yes-pattern is used; otherwise the no-pattern (if present) is used. There are two kinds of condition. The first part matches an optional opening parenthesis, and if that character is present, sets it as the first captured substring. If the condition is the string (R), it is satisfied if a recursive call to the pattern or subpattern has been made. If the condition is not a sequence of digits or (R), it must be an assertion. (? The condition is a positive lookahead assertion that matches an optional sequence of non-letters followed by a letter.

HTML5 Full-Screen Demonstration Oh look – a squirrel. Click to view full-screen… This demonstration illustrates how to use the HTML5 full-screen API which has been implemented in Firefox, Chrome and Safari. For further information, please refer to the article How to Use the HTML5 Full-Screen API… This example code was developed by Craig Buckler of OptimalWorks.net for SitePoint.com. Please view the source and use this code as you wish.

Related: