Monday, August 4, 2014

Golden Frame animation on HTML5 Canvas with bandwidth optimization

The Problem:

The title of this post looks weird as the first thought comes to our mind is how come the network bandwidth links to HTML5 canvas animation?

Well, as such their is no direct relationship between them but if you limit the size of your application (mobile game) then such relationships comes in to your mind. In my last project I have to struggle out to achieve an animation like glowing frame in best possible and optimized way.

The Solutions:

For the solution that approached is to build a sprite sheet of the animation and render the frames in time tuned environment on the canvas and voila!!!... so quick so efficient and get work done. Every thing works perfect but when comes to low end devices, memory profiling and network profiling things get worst. The limitation of this solution is the size of sprite sheet. For smooth animation the sprite sheet is close to 1200 KB which is too high.

Second proposed solution is to remove some frames from the sprite image and create an in-memory sprite sheet from some images. This is again a failed solution due to memory constraints and the animation looks horrible as in this approach the static memory is consumed.

Some interesting facts that comes up with such solutions are.

1) Size limit of your application.

In my case it is close to 2 MB which includes all the images, animations, configurations, resource files, audio files, JavaScript libraries and application JS. So we can't afford a large sprite sheet.

2) Cost of Network.

Its ok if your target audience is has a mandatory wifi connection. as the long request worsen the situation on mobile packet data. The long requests generally terminated by platform based on their limited resources like memory, battery, network availability.

3) Cost of memory

In cross platform application development we have to consider a variety of devices. memory intensive applications works perfectly on desktop browsers and close to perfect on high end mobile devices & PDA's but crashes on low end devices. Nokia Lumia 520 windows 8 and iPhone4 are expectedly good low end devices.

Final Solution:

This solution consist of only two separate images with total size 50 KB approx. And I implement the whole animation with these two images using globalCompositeOperation of canvas.

The "globalCompositeOperation" property sets to configure how a source (new) image are drawn onto a destination (existing) image.

The images that are used are :

1) A transparent Golden Frame
2) A Circular Mask

These images has gradient effect to produce a nice flowing animation as a spot light moves on some frame.

The concept

The concept is to layer both the images in a stack and move the mask along the frame. The timings is tuned to get the smooth effect in the animation. The canvas is configured to have "source-in" globalCompositeOperation which makes a certain portion of the frame visible which is covered by black portion of the mask. And there you go!!

Refer different global composite operations here


I can set up my new thought from this post. It gives inside and out data. A debt of gratitude is in order for this significant data for all,.. SEO in New Jersey

In this time of affectation, the author has composed each word with his entire being filled it.landscape canvas prints

I do not have a bank account how can I place the order? ny web design firms

I am typically to blogging and i genuinely appreciate your posts. The content has truly peaks my interest. Let me bookmark your web site and maintain checking for brand spanking new information. new york web designs

Hey there, You have done a fantastic job. I will definitely digg it and personally recommend to my friends. I’m confident they will be benefited from this website. san francisco design agency

Excellent post. I was checking constantly this blog and I’m impressed! Very helpful information specially the last part I care for such information much. I was seeking this particular information for a long time. Thank you and best of luck. branding agencies in san francisco

And Im running from a standard users account with strict limitations, which I think may be the limiting factor, but Im running the cmd as the system I am currently working on. san fran design firms

There is noticeably a bundle to know about this. I assume you made certain nice points in features also. design agency san francisco

acer laptops have much brighter lcd screens compared to other brands` device mockups

Hi this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be greatly appreciated! converting websites

I have been checking out a few of your stories and i must say nice stuff. I will surely bookmark your website web design company

Right off the bat, the characters included must be made. cosplay costume

A genuine case of this is the ongoing 'DairyLea' advertisements, made in a 3D Stop Movement method it gives some talking cows urging kids to eat their item, all alone, however with crushed potato. manganelo

So how would you understand what it will take to will page 1 for your site and catchphrases? A decent SEO master ought to have the option to take a gander at sorts of connections your rivals have and give you a feeling of what it will take to get your site on the primary page of Google indexed lists for any watchword. SEO no cure no pay

Both compensation per-snap and SEO are focused to get your site set as near the highest point of web index results as could really be expected. Showcasing and SEO are extraordinary, yet extremely, comparable. details

appearance relying upon the present status of the animation. See Table 1 for a portrayal of the catches on the Animation board. anime 2021

Since fundamental squares have no control stream, these optimizations need little examination. Ebay Google SEO expert

Can one get a affiliate marketer connect to your own web host? We desire my personal site packed upward because quickly because your own lol
Amazing, wonderful อ่านการ์ตูน weblog design! Just how long are you currently running a blog with regard to? a person made running a blog appear simple. The entire appear of the web site is actually wonderful, as well as this content!

Just desire to express a person's posting is often as amazing. manga

My nephew suggested I would along these anime lines website.

Daily as Web marketers or online business owners we read tons of information about Search Engine Optimization. One expert say's one thing, another expert states totally different facts. Thus everyone is getting confused about what really is going on in SEO industry. We decided to conduct a comprehensive research and show you what really works and what not. Read thoroughly these 40 SEO myths and stop getting fooled by so called "SEO experts" that simply creating empty buzz. Search Engine Optimization was-is-and will be as a vital part of online marketing strategy, no matter what! cheap web hosting

Nonetheless, while 2D animation requests as much ability as does 3D animation, it is by and large quicker to make just in light of the fact that it doesn't need a third youtube views india

We can get into the main points of methods that you can obtain manga for your eReading device. mangakakalot

Manga, or Japanese comics, are extremely popular in Japan but gaining more and more fans in the US. But manga is more than just comics. 4 anime

Japanese cartoon art have been one point of interest to the creation of Japan to the full world. We have reached know more info on Japanese culture and ways in which the united states has risen being what it is now. read manga online

We have reached know more details on Japanese culture and how the united states has risen to become the goals now. 9 anime

HTML5 Canvas components allow for art and animation to be shown in the browser. In this article, we'll look at the HTML5 Canvas element's possibilities when combined with JavaScript. Simple "pen" drawings, 2D Video animation services picture showing, and image manipulation are all examples of this.

Excellent post however I was wondering if you could
write a litte more on this subject? I’d be very grateful if you could
elaborate a little bit further. Thank you!상주출장샵

These intonations can assist with drawing out the excellence of your specialty and add security to the general frame.
eagle construction framing

Post a Comment