Pinch and Rotate

Chris Sheffield cmsheffield at me.com
Mon Jan 23 18:19:08 EST 2012


Ken,

Did you try setting acceleratedRendering to true and then setting the layerMode property of the image to "dynamic"? Might make a difference. Kind of guessing, though.

Chris


On Jan 23, 2012, at 4:02 PM, Ken Corey wrote:

> Hiya Thomas,
> 
> I've been meaning to take a stab at this, and your post got me off my duff.
> 
> I've seen a few apps that do multitouch pinch to zoom *really* well.  by that I mean that the pinch can accomplish 3 things at the same time:
> scale something
> rotate something
> move something
> 
> The last one makes it feel really slick.  Of course, if you only wanted to do one of those, no problem.
> 
> I wanted to build and API with 3 main calls:
> pinchStart
> pinchMove dDistance, dAngle, dX, dY
> pinchEnd
> 
> Start and End are for setup/cleanup, and pinchMove is where the work is done.
> 
> I've created a sample script to demonstrate the concept:
> 
> http://its.ec/static/multitouchtest.livecode.zip
> (I packaged it up this way because there is a image involved.)
> 
> This "works" on my iPad. Jerky, but it works.
> 
> On my Nexus One, the app is less impressive.  Things can move, but when you try to rotate, the rotation is not uniform.  Sometimes it rotates, sometimes it doesn't, sometimes it goes backwards.  *shrug*
> 
> It is possible to build a test harness for a desktop in just a few lines of code, but in this case I pulled them out for brevity.  That means that if you've got an iPad it will work fairly well. My PC nor my Mac have multi-touch built in, so I don't know how they'd do.
> 
> As always, there're flies in this particular ointment:
> 
> 1) Images can't scale and rotate at the same time. In my demo, the image will rotate and move, but only when the angle of the image is zero will it scale...this will appear as "pop" of a larger image.
> 
> A horrible work-around could be to use your main image as a template. Clone it, scale that, take a snapshot of it at the zoomed size and /then/ rotate that.  Ugh.  Any better way to skin this one?
> 
> 2) Graphics can't be rotated natively. I found that only some graphics even report their points (rectangles, rounded rects, ovals, etc don't...so you can't rotate them).
> 
> The horrible hacky way around that might be to try to implement the regular polygons using a Polygon, or even a "Freehand Polygon".  Maybe.
> 
> Then, you could implement a rotation routine for such a Frankenstein poly. Blech.
> 
> 3) It's jumpy, big time.  Worse come to worse, you could try to build-in an averaging function, but I was quite surprised how jumpy it all is.
> 
> 4) Not sure about the Android support.
> 
> 5) Not even sure where'd you'd use this kind of thing because of uneven support. Can't use scaling with images.  Can't use rotation with graphics.  Both are painfully jerky.
> 
> I'm quite a LiveCode newbie, so if anyone has constructive feedback on my code, or knows a more-runrev kinda way to do things I'd appreciate if you'd let me (or the list) know.
> 
> Thanks,
> 
> -Ken
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list