Exporting motion(animations) from Flash

Hi guys,

I have found a great tool for Cocos 2D that uses this technic for exporting animations from flash as xml, converts them using 3-d party Air app into plist file that is used by custom(wrapper) animation class.
This way we get cocos2d sequence actions as output. The process is described here: http://www.youtube.com/watch?v=8ZyqGrdkTtM

My idea is to port such functionality to Corona

I wrote the sequence.lua class ( http://developer.anscamobile.com/code/sequencelua-transition-execution-order ) as a first step to port it

What do think about it?
[import]uid: 55503 topic_id: 16500 reply_id: 316500[/import]

I built a timeline animator for use with Spriteloq that I’m using for Cannon Cat. I’d like to make it available for customers of Spriteloq, but I’m thinking of waiting for an update Corona to optimize the sprite performance.

Check out some early video fo the game and the intro: http://www.youtube.com/watch?v=QpYmQztShFU. It was all drawn and animated in Flash, then exported with Spriteloq and run in the Corona simulator using the Spriteloq API.
[import]uid: 27183 topic_id: 16500 reply_id: 61624[/import]

Wow!
Your game looks really great)
I am using your Spriteloq (trial) but in any case planning to buy the licence as soon as posible. Want to say that it’s great and saves me a lot of time and effort! Tnx!
In a moment i am working on game template(small engine) with a bit modified SceneManager that uses Spriteloq layouts, abstract Class-based scenes and actors with a lua FSM bound. Also all the spritesheets are spriteloq based too. My idea is to build real OOP game template (i came from Cocos2d) and don’t like this global lua mess.
But still i have an estimate (can’t wait for your release) and i’am half done on porting above motion exporter, so i think i will finish the beta tomorrow (need to slightly modify the Air app)
[import]uid: 55503 topic_id: 16500 reply_id: 61699[/import]

I’m glad you’re enjoying Spriteloq. I’d love to see how your motion exporter works out. There are features that are missing because Corona either lacks support (skew, color transforms) or difficulty of implementation (shape tween, motion tween). So maybe I can “steal” err… learn something from your version. :slight_smile:

The version I wrote is a jsfl script which converts the animation data into a lua file which is then programmatically animated. It has an API similar to SpriteFactory and SpriteGroup for ease of instantiation and disposal.

Looking forward to seeing what you produce.
[import]uid: 27183 topic_id: 16500 reply_id: 61704[/import]

Hi guys,

As promised)
http://www.4shared.com/file/cXHt24Ya/Flash2CoronaTweenExporter.html?
I think you’l easy find out how to use it;)

Looking forward to hearing some feedback! [import]uid: 55503 topic_id: 16500 reply_id: 62081[/import]

very good idea and i tested your tool and it worked.

wish spriteloq to have such a functionality. here is my test code to parse a motion xml of flash and pass the parameters to transition function of corona. you may watch a demo video http://youtu.be/2_dTp7nAPZI

[lua]require(“xmlparser”)
– LUA only XmlParser from Alexander Makeev
local path = system.pathForFile(“tween.xml”)
– xml from: FlashCS5 > Command > Export Motion XML
– the following example code based on tween.xml has four keyframes
local tweenData = XmlParser:ParseXmlFile(path)

local tween = {}
tween.keyframes = {}
local lastIndex = 0
for i,xmlNode in pairs(tweenData.ChildNodes) do
if(xmlNode.Name==“source”) then
for j,subXmlNode in pairs(xmlNode.ChildNodes) do
if(subXmlNode.Name==“Source”) then
tween.source=subXmlNode.Attributes
end
end
elseif (xmlNode.Name==“Keyframe”) then
xmlNode.Attributes.numFrames = xmlNode.Attributes.index - lastIndex
lastIndex = xmlNode.Attributes.index
table.insert(tween.keyframes,xmlNode.Attributes)
end
end

local rect = display.newRect(28,70,66,47)
rect:setFillColor(0,100,100)

local makeParam
local func01, func02, func03

func01 = function() transition.to(rect, makeParam(rect,tween.source,tween.keyframes[2], func02)) end
func02 = function() transition.to(rect, makeParam(rect,tween.source,tween.keyframes[3], func03)) end
func03 = function() transition.to(rect, makeParam(rect,tween.source,tween.keyframes[4])) end


makeParam = function(rect, s,t, func)
local ret = {}

if t.x ~= nil then
ret.x = s.x + t.x
end

if t.y ~= nil then
ret.y = s.y + t.y
end

if t.rotation ~= nil then
ret.rotation = s.rotation + t.rotation
else
if rect.rotateDirection ~= nil and rect.rotateTimes ~=nil then
if rect.rotateDirection == “ccw” then
ret.rotation = -360*rect.rotateTimes + rect.rotation - s.rotation
else
ret.rotation = 360*rect.rotateTimes + rect.rotation - s.rotation
end
else
ret.rotation = rect.rotation - s.rotation
end
end

if t.rotateDirection ~= nil and t.rotateTimes ~= nil then
rect.rotateDirection = t.rotateDirection
rect.rotateTimes = t.rotateTimes
end

if t.scaleX ~= nil then
ret.xScale = s.scaleX * t.scaleX
end

if t.scaleY ~= nil then
ret.yScale = s.scaleY*t.scaleY
end

ret.time = t.numFrames*1000/s.frameRate

if func ~= nil then
ret.onComplete = func
end

return ret
end


rect.x = tween.source.x
rect.y = tween.source.y
func01()[/lua]
[import]uid: 190 topic_id: 16500 reply_id: 67256[/import]

Hi CalledPaul

Came across your post here about your Flash2Corona solution. I’ve been hunting for this for a while so was glad to see your link. Then it was a shame that your 4shared link has expired. Any chance of a re-post?

Thanks.

Hi CalledPaul

Came across your post here about your Flash2Corona solution. I’ve been hunting for this for a while so was glad to see your link. Then it was a shame that your 4shared link has expired. Any chance of a re-post?

Thanks.