Which has higher performance in phonegap? Canvas or HTML Elements? - javascript

Imagine we want to create a cross-platform (iOS, Android, Win...) app using PhoneGap (and we are as expert as to know that native-apps has higher performance in contrast with using a framework but anyway we just decided to do it with PhoneGap).
The app is really simple 2 pages (LOGIN/REGISTER) and nothing more.
We are handling the login and registration process somehow with JAVA
and it's not matter for us now.
What is just matter is the performance of the user interface (including time of initializing the app and motion and transition of pages inside of the app). We implemented two pages (LOGIN/REGISTER) with HTML elements (Form, Input, ...) and there's a button for switch between two pages with sliding effect and we used jQuery mobile for that.
The question is if we all forget about he STRATEGY of using HTML
elements and jQuery mobile and instead using a new strategy which is
creating canvas and using a library like KineticJS or other similar library inside
and implementing our LOGIN/REGISTER and TRANSITIONS (slidding effect)
all inside of the canvas
.
will this change of strategy affect the performance of the app?
and if the answer is yes in which direction? The performance will increase or decrease?

Related

Best practices for designing an Angularjs Material mobile site - Viewport question

I am starting to build my angularjs material mobile site. I am taking an existing desktop site already built and making it responsize for mobile.
I added the following tag in my header HTML code:
<meta name="viewport" content="width=device-width, initial-scale=1">
Upon refreshing im noticing that everything now appears to be zoomed in and font size had increased. Ive been adding style tags to reduce the font size manually but its getting really teidous and this site needs to adjust to tablets as well.
Cant seem to find any documentation that shows best practices on how to handle this. Am I suppose to play with the intial-scale value in my meta tag and lower it until I find a sweet spot that would work ith all my devices? Or am I suppose to play with the CSS and lower the font size of all components manually?
I am a bit confused on what best practices are for this. The AngularJS Material website has no mention of viewport issues. Would anyone be able to assist or provide some insight?
AngularJS Material works with breakpoints, as most style frameworks do.
You can find a reference for the breakpoints here: https://material.angularjs.org/1.1.5/layout/introduction
If you are new to responsive design, then you should start by some basics, as in what actually is a viewport, what does it mean?
The browser's viewport is the area of the window in which web content
can be seen. This is often not the same size as the rendered page, in
which case the browser provides scrollbars for the user to scroll
around and access all the content.
Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag
In your meta tag, you define the viewport behavior, and what you defined is pretty much the standard to go by.
The reason why your font-sizes are changing is most likely because the app had initially styled them one way without a defined viewport, and now that your viewport has been defined, you're seeing a different scaling.
Now, another very important point I noted in the beginning is breakpoints, what are breakpoints and how do we use them? And to address a part of your own question, what's the best practice?
If you are familiar with classic CSS, then breakpoints can be referred to as media queries.
Media queries are useful when you want to modify your site or app
depending on a device's general type (such as print vs. screen) or
specific characteristics and parameters (such as screen resolution or
browser viewport width).
Source: https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries
Media queries are used to define style changes, based on a given device width (and/or height). In most cases, you go by the width definition alone (it's also what you'll see as referred units in various style library docs, such as AngularJS Material).
The exception to only defining media queries by width, is when you want to be very specific towards tablets. This is because bigger tablet sizes collide with desktop breakpoints, which is usually standardized to begin at 960px (sometimes you'll see 958px or 959.8px).
Now, what is considered best practice?
The best practice for responsive design is commonly referred to as the "mobile first" approach/design. You start by designing for the lowest screen resolution you want to support (280px for very outdated devices, 320px by today's standards) and work your way up.
Mobile-first design is a key ingredient to successful product design.
Designing for the smallest screens first, and then working your way up
empowers designers to focus on the core functions of their product.
When you focus on the core of your product and strip away the rest,
you are able to pinpoint the most important UX components of the
product.
Source: https://xd.adobe.com/ideas/process/ui-design/what-is-mobile-first-design/
Extra: https://anglestudios.co.uk/blog/why-mobile-first-web-design-is-becoming-more-important/
You can find various articles on the mobile approach very quickly by doing a very simple Google search query if you want more references etc.
My advice, would be to familiarize yourself by using the defined breakpoints in AngularJS Material, and use the same breakpoints in your own custom CSS if you want to apply more custom styling that's not easily achievable by native uses of AngularJS Material.
This way, you'll learn the basics, get familiar with the concept, and then, in the future, you can start thinking about incorporating things like NativeScript with Angular, which is what you'd ideally be using in a mobile app development environment.
Today we’re happy to announce an exciting new way to build web and
mobile apps with Angular and NativeScript.
First, some background: since the beginning of Angular, you could use
NativeScript with Angular to build mobile apps.
NativeScript is an open source framework for building truly native
mobile apps with JavaScript. It lets you use your existing Angular
skills, and as a result you get a native UI & performance on iOS and
Android.
Source: https://blog.angular.io/apps-that-work-natively-on-the-web-and-mobile-9b26852495e7
Link to NativeScript, here.
Happy Learning & Coding!

Different size of the components in the view depending of the operating system or target

I am working in a hybrid application which target is Windows 8.1 and iOS, but I am looking the size of the components (buttons for example) are different.
I would like to know how to handle this difference in terms of size depending of the application target?
Thank you in advance
Not sure what you want to do... but I think issues you are having is that UI elements are styled differently in different browsers.
This is a common problem we all face... not to worry, just use reset.css so that all your ui elements appear similar across different browsers and operating systems.
--- EDIT : RWD solution for different resolutions ---
If you want to have different style adjustments for different resolutions... you can go for Media Queries...
If you have just started building the app, a front end framework, like bootstrap, will get you up and running quickly.
Learn more about bootstrap grids here
But if you have most of stuff done media queries is the way to go.

visibility hidden vs -webkit-transform: translate3d() in phonegap application

So I am using phonegap to create a hybrid application. Now obviously I have many divs(page size) that I hide and show using css "visibility: hidden and visible" property. I read somewhere that by using -webkit-transform: translate3d() I can hide the divs offscreen and show them again when needed and that this technique is much better. Does anyone know is this really true or not?
The main reason why anyone would want to use translations instead of standard visibility or display attributes is perception of performance. One can control exactly how a transition from one state to another state performs. A good example is mobile apps where transitions with animations are very popular.
If you want to use it within your app and do not need third party controls or out of the box MV** support, take a look at the Famo.us framework (http://famo.us/). While it lucks controls, it is very fast, uses transformations and incapsulates browser details.
Kendo UI Mobile is another good framework. It is a MV** framework, has a reasonable set of controls and ability to control look and feel. While it is a complete framework, one can integrate it with with Knockout and AngularJS.
And of course, give it try to Ionic (http://ionicframework.com/) and see if it is fast enough for you.
In any case, it is the best to use some framework and not use it directly. It is a lot of work to do otherwise correctly.

CreateJS/EaselJS web page (not game) consisting of several pages

I have coded an existing (pure) HTML5 Canvas web page consisting of several pages, 'buttons' and 'hotspots'. It is pure canvas javascript code.
Reason why I put 'buttons' and 'hotspots' in quotes is because I have actually implemented those in pure javascript from scratch without using any framework, just created 'classes' for buttons, hotspots, mouse event detection, etc.
These elements are approaching end of its functionality, so I need better elements and especially a scrollbar which will respond well to mouse scrolling.
As web site is redesigned and a lot more new and complex requests are needed to be implemented, it is no more feasible to continue coding in javascript as such, i.e. I need a serious graphical framework.
Between KineticJS and CreateJS/EaselJS I chose the latter.
Now, since this is not an one-page game, but several page long website with somewhat complex navigation relation between pages, can someone advise me what approach should I take?
Containers, just 'pages' with 'buttons' on it, what should be taken for a button, how to handle different pages and machine states in CreateJS/EaselJS?
Did I made the right choice? Is this easier in KineticJS?
Can you share an experience and/or advice, please?
Since EaselJS is "just" a graphical framework, there is no native support for states. However compared to KineticJS I wouldn't say that there is a huge difference for you purpose (someone correct me if I'm wrong here)
I'd use the same approach of using Containers as Pages. For buttons I'd use the ButtonHelper-class: http://www.createjs.com/Docs/EaselJS/classes/ButtonHelper.html
You probably knew most of that already, but I thought I'd still share it, maybe it does help you.

jbgallery vs supersized js vs flash

I have been asked to create a website where the homepage consists of a fading image slideshow and a navigation bar at the bottom of the page. The client wants the image to cover the entire screen with the exception of this nav bar with a pause/play button at the top right of the screen.
I have built this using the supersized jquery function and made a few tweaks, but there seems to be performance issues with the fading effect (its very static and transitions dont appear to flow very smoothly).
Before I get stuck into the remainder of the site, I want some advice from the seasoned experts out there on using this function, or the jbgallery jquery function I have recently come across. Alternatively what is the general consensus on building the whole site in flash.
I haved used flash sparingly before due to CMS issues (which I have now worked around) and ipad display problems etc so would need to do a bit of learning to go down this route but am more than happy to adopt the approach if people really think it is worthwhile. My experience to date has consisted of including swf animations and components within php pages populated via mysql using xml files.
Looking forward to any and all advice (not simply for this project but future ones aswell!).
Thanks
JD
I'm actually trying to work out the exact same problem right now. I don't have a perfect/easy solution yet, but here's something that might work:
http://playground.benbarnett.net/jquery-animate-enhanced/
It's a jQuery plugin that takes your standard animate() calls (and a few others) and uses CSS3 transforms when possible. This will theoretically improve the frame rate of transitions since CSS3 effects perform better in modern browsers. I have smaller demos working, but am having trouble getting a lower frame rate for full-browser images.

Categories