Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Opinions Wanted - HTML5 Canvas or Titanium APIs for Drawing

I've been looking at drawing tutorials for HTML5, and I am familiar how to move views around with the Titanium APIs. I want to make a physics app that shows how gravity works so I'll be drawing simple objects interacting with each other.

Should I move them around using javascript and the Titanium UI views, or should I draw them with HTML 5?

It seems like Titanium would be easier, but I suspect people have written libraries for automatically creating and moving objects in HTML 5 that might work in a web view.

I'd be interested in anyone's opinion or experience with this type of thing. Thank you.

— asked September 15th 2010 by shawn gordhamer
  • drawing
  • graphics

3 Answers

  • I'm currently trying to make functions that let me drag, drop and transform, and also Draw lines.

    Neither of them I'm getting to work, I had drawing natively in Titanium, but it was a major memory hogger, and really slow on the device itself.

    Opted to go for a webview, using html/javascript and titanium, but it works on simulator but not on the device itself cause it never loads my init functions.

    I feel very restrictive at the moment using titanium in trying to use 2 of the core multitouch capabilities in my opinion.

    the ipod/ and expecially ipad give themselves away to these kind of apps, drawing and or physics, but Titanium can't really do both as of yet natively, it still involes you trying to make a module using objective-c.

    So i'm eagerly awaiting the module marketplace which will come after 1.50 appearantly.
    this will lift titanium up to one of the best dev apps.

    but for now…it wil be rather "challenging"

    — answered October 5th 2010 by Patrick van Zadel
  • With regard to what does/does not work in a web view, you should be able to do anything you can do in mobile webkit. If your initialization scripts are not being run on the device, I would be curious as to why that is the case - are you able to run any scripts at all? Is it just document ready that's not being called? Could there be a timing issue at play? Answering all those questions would probably lead to answers to the greater issues Patrick is having.

    That said, whether you use HTML 5 techniques or Titanium animation APIs backed by the native animation capabilities of the device, you should be able to achieve some pretty sophisticated animation. I would lean toward using native Titanium views/animations, but if you'd rather do your entire UI in HTML/CSS then HTML 5/CSS 3 animations will work also. Only caveat there is that on some Android releases, some CSS 3 animation features are not hardware-accelerated.

    — answered October 5th 2010 by Kevin Whinnery
  • Currently the init() function gets loaded, atleast the alert I put into my init function gets loaded.
    but it never starts the touch events…
    It runs on simulator and android but not on iOS devices, the touch event doesnt get registered or atleast something is blocking the code to start.

    — answered October 6th 2010 by Patrick van Zadel
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.