Skip to main content
Participant
December 26, 2006
Question

Shape Tweening via ActionScript?

  • December 26, 2006
  • 5 replies
  • 515 views
Hey all,

I am trying to create a tweening using ActionScript between two vector graphic shapes.

The application is very simple: I have frames with different shapes (frame 1: circle; frame 2: square; frame 3: triangle and so on). I have an edit box in which the user can select two frames. I want to automatically create a tweening between those shapes and display it to the user.

From what I saw, the Tween Class can affect only size, location, alpha, etc. There is no option to define two objects (or for that matter two frames) and let the Action Script interpolate between them... is that so? Does anyone have creative suggestions for solving this problem?
This topic has been closed for replies.

5 replies

kglad
Community Expert
Community Expert
March 17, 2008
no. you can use actionscript to create a tween between two shapes. but it's not easy.

check www.kglad.com/code snipets/shape tween for an example using a.s. to tween arbitrary shapes.

March 10, 2008
So, digging up an old topic here.

Is this still the case where you would need to generate every possible tween up front between the shapes that are available in order to use actionscripting to generate tween effects between 2 different shapes in the library dynamically?
Inspiring
December 26, 2006
Create all the n * (n-1) possible tweens and just display the appropriate
one the user selects. You don't have to do EVERYTHING in script :)
--
Jeckyl


kglad
Community Expert
Community Expert
December 26, 2006
you have to draw all intermediate "tweens", not just practically all.

and there is no easy way to do that but it is doable using the bitmapdata class.
kglad
Community Expert
Community Expert
December 26, 2006
yes, it's true that you cannot shape tween using actionscript alone. you could use a combination of actionscript and timeline tweening and that would probably be the easiest for the situation you're describing.

you could utilize the drawing methods and sequentially draw the shapes that you want but that would be more involved that combining actionscript of timeline tweening.
daphiesAuthor
Participant
December 26, 2006
Thanks.

So you're saying that I have to practically draw all the possibilities (square to circle, square to triangle, circle to square and so on)...? Does it mean that if the shape is dynamic (e.g. drawn by the user in real time) there is no way of displaying a tween between it and another shape?