Skew, tint, custom fonts

Hello!

My app really needs a couple of features that I can't seem to figure out how to do properly in Corona.

First, skewing, identical to skewing in Flash*. As far as I understand, I can do skewing as a combination of rotating and scaling. However, it seems tedious to animate a skewing animation of an object that has scales/rotations/translations as well - for example, it seems troublesome to synchronize skewing with the other changing parameters.

I think it's possible, and I will definitely try this if I don't get an answer (I've already posted this question: http://developer.anscamobile.com/forum/2010/03/01/advanced-transformations ), but it seems like such a simple thing to do if given access to the transformation matrices of objects directly. So, my question is this: is there any way to access these transformation matrices? If not, any chance skewing, or access to transformation matrices, could be made available in Corona in the near future (week-two, three tops), in a fashion that will allow me to add the parameters I need to a transition.to call?

Second, I need tints - also identical to Flash's. Actually, I also need something like a glow (or outline) filter, so perhaps I'd like a means to do pixel manipulation in Corona. However, if I could get at least tints, that'd already be great.

Another thing I was interested in is custom fonts. Is there any way to use custom fonts in Corona?

*http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/geom/Matrix.html - link to the exact skew I need =)

I spent some time with the math on how it could be possible to implement skewing by a series of scales and rotations, and I think I've proven that it's impossible (which was my first intuition, but I was reeeaaally hoping it was possible :)). It's possible to do all sorts of skew-like things - keeping parallel lines parallel and all - but the skew I need does not come from a series of rotations and scales.

So, I'm hoping that it's possible to get this feature in the nearest future. I would appreciate some comments from the devs on this: if it's a reasonable wait, I don't think we want to numb-down a lot of our existing animations.

I managed to get skewing working by nesting 4 display groups and adding the sprite to the innermost one.

What I did was to create a display object wrapper that generates the appropriate amount of nesting I needed (four in this case) and then add the display object to the inner most one.

I used the formula as defined here: http://www.eecs.berkeley.edu/~ug/slide/pipeline/assignments/as5/transforms3d.shtml#shear_rot_scale_rot_scale

Using that formula, the code looks like so (nest[1] is the outermost group and nest[4] is the innermost group):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
shearX = function(self, x)
    -- an array containing references to nested display groups
    -- you need to define this somewhere
    local nest = self.nest
 
    -- positive only, invert rotations for negative x
    local shx = math.abs(x)
    
    local t1 = 1 + shx
    local t2 = 1 + shx + shx * shx
    local t3 = 1 / t1
    
    local a = math.atan( t3 )
    local s = math.sqrt( t1 * t2 )
    local b = math.atan( math.sqrt( t2 / t1 ) )
    local sx = math.sqrt( t3 )
    local sy = math.sqrt( 1 / t2 )
    
    if x < 0 then
        nest[1].rotation = -a
        nest[3].rotation = b
    else
        nest[1].rotation = a
        nest[3].rotation = -b
    end
    
    nest[2].xScale = 1
    nest[2].yScale = s
    
    nest[4].xScale = sx
    nest[4].yScale = sy
end
views:1398 update:2011/10/17 8:58:49
corona forums © 2003-2011