Problem with HTML5 & cpp targets using an Actuate.tween with rotationY and OpenFL/Lime

291 views
Skip to first unread message

markosborne

unread,
Mar 11, 2014, 11:23:49 AM3/11/14
to haxe...@googlegroups.com
Hello All,

I'm new to Haxe and am trying to port some AS3 code to Haxe using OpenFL/Lime and Actuate (Mac OS X). I'm having a problem with the HTML5 & cpp targets using an Actuate.tween with rotationY.

The main body of the code is:

------------------------

var sp_test:Sprite = new Sprite();
       
var bitmap = new Bitmap (Assets.getBitmapData ("assets/CardBackPattern.png"));
bitmap.x = bitmap.x - (bitmap.width/2);
bitmap.y = bitmap.y - (bitmap.height/2);
sp_test.addChild (bitmap);

addChild(sp_test);
       
sp_test.x = (stage.stageWidth - bitmap.width) / 2;
sp_test.y = (stage.stageHeight - bitmap.height) / 2;

Actuate.tween(sp_test, 1, { alpha: 1.0, scaleX: 0.5, scaleY: 0.5, } ).ease (Quad.easeIn);
Actuate.tween (sp_test, 1, {rotationY: 90}, false).smartRotation().ease(Quad.easeIn);

------------------------

It all works fine in Flash target, but with HTML5 the rotationY tween doesn't appear to have any effect (the scaleX & scaleY tween works fine). I tried compiling for 'mac' (lime test mac) but the compiler breaks with 'Invalid field:rotationY'.

If I change the 'rotationY' to simply 'rotation', it works with Flash, HTML5 and cpp targets (although not with the tween effect I want - I'm trying to create a card flip).

Any thoughts anyone?



Justin L Mills

unread,
Mar 11, 2014, 8:55:26 PM3/11/14
to haxe...@googlegroups.com
rotationY is a flash 2.5D feature ( 3D ), and unlikely to be supported
in html5 and cpp targets as they are (probably) setup to only support
the flash 2D api.

For html5 you can use css take a look at the output of Google Web
Designer when you start moving stuff in 3D should be able to use similar
if supported in the browser, or look at something like three.js there
are haxe externs.

For c++ target maybe try looking at a 3D library like away3d or h3d or
foo3d with openfl.

Best Justin

markosborne:

markosborne

unread,
Mar 14, 2014, 5:36:31 AM3/14/14
to haxe...@googlegroups.com
Thanks Justin,

That explains things - I was under the impression that Actuate tweening would work across all the OpenFL/Lime targets.

I'm now working on a cross-target pseudo 3D card flip effect solution using this for inspiration: http://www.flashandmath.com/advanced/card/index.html

Best

Mark

Joshua Granick

unread,
Mar 14, 2014, 5:45:59 AM3/14/14
to haxe...@googlegroups.com
Yeah, Justin is right...

Actuate does work across all the targets, but Actuate only changes numbers. Unfortunately, OpenFL does not support rotationX/rotationY, thus why this may have errored or not worked at runtime.

A matrix could possibly do it, interested to hear if this works out!
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.



--
Using Opera's mail client: http://www.opera.com/mail/

markosborne

unread,
Mar 15, 2014, 11:48:44 AM3/15/14
to haxe...@googlegroups.com
Thanks Joshua,

Yes, I managed to get things working using the Flash example at: http://www.flashandmath.com/advanced/card/index.html (which uses slices of bitmaps and a transform matrix - very clever stuff). Not quite as good as using rotationY on the Sprite, but an acceptable compromise.

It was very straightforward to convert the code to Haxe. A learning point for me was not to use Array<Dynamic> to store bitmaps in: setting their visible property had no effect in HTML5 (e.g. bitmapArray[0].visible = false). They needed to be stored in an Array<Bitmap> to this to work in the javascript.

Plus, when compiling for Neko (on Mac) an error was thrown up in one function (function findVecMinusVec) as it was trying to return a value from slot 3 of arrays passed as arguments which only had 2 slots (Flash & HTML5 forgave this NaN value).

Overall, so far I'm extremely impressed with the performance of Haxe & Lime/OpenFL. It's early days for me though and I have a lot to learn and test...

Mark

markosborne

unread,
May 12, 2014, 2:08:31 PM5/12/14
to haxe...@googlegroups.com
I'm having trouble with the new/latest HTML5 backend with OpenFL. The card flip effect I had working is now broken: instead of a flip around the vertical Y axis, it seems to use the top centre of the card as the anchor point and swings around that (Mac Firefox & Chrome). If I revert to openfl-html5-dom it works fine.

Plus, mouse/touch events are not working on iOS devices (iOS 5 & 6 on iPads & iPhone) with the new backend - mouse/touch events work if I revert to openfl-html5-dom. Same happens in another app.

BTW I've also noticed that with openfl-html5-dom on iOS the graphics/sprites in the app are selectable, which is not something I want (this doesn't happen with the new HTML5 backend). Same happens in another app.

Any thoughts anyone?

Mark
Reply all
Reply to author
Forward
0 new messages