Solved: Animated Timeline (MovieClip) Material

Software: Away3D 4.x

Fab4ce, Jr. Member
Posted: 21 March 2012 03:17 PM   Total Posts: 44

First of all I want to say a big thanks to the away team. You guys are amazing!

Many people are asking for the MovieClipMaterial these days.
Now I´m happy to give something back to the community.
Don´t expect to much…it´s not an interactive MovieClipMaterial.

When I was working with Sprite3D, there was definitely something missing…some animation.
So I was thinking about Spritesheets, which seemed to much work for a little animation. So i came up with something different, as a Flash IDE user:
timeline animation, captured in bitmapdata.

Feel free to use and modify this class.

Here is how you use it:

// private variables
private var timelineAnimation:TimelineAnimation;
private var 
animatedSprite3D:Sprite3D;

// instantiate your movieclip from the library (export for actionscript)
var mc:MovieClip = new HotspotMovieClip();

// pass your movieclip to the class
timelineAnimation = new TimelineAnimation(mc);

// take a mesh (or Sprite3D) and pass the material from TimelineAnimation
animatedSprite3D = new Sprite3D(timelineAnimation.material500500);

// position and add
animatedSprite3D.9000;
scene.addChild(animatedSprite3D); 

 

// call the playOn method in your render loop and pass in an array of your meshes
timelineAnimation.playOn(arrayHotspots);

// or if you have only 1 mesh
timelineAnimation.playOn([animatedSprite3D]); 


Big thanks for the code snippets from JohnBrookes and Quasimodo.

 

File Attachments
TimelineAnimation.as  (File Size: 2KB - Downloads: 393)
TimelineAnimation.zip  (File Size: 1KB - Downloads: 508)
   

Alex Bogartz, Sr. Member
Posted: 21 March 2012 08:23 PM   Total Posts: 216   [ # 1 ]

I just sent Fabrice some code that loads in a sprite sheet from TexturePacker and does something similar.  Hopefully we can combine all this and come up with sprite sheet support as well as Flash timeline support.

Thanks for contributing!

   

Alex Bogartz, Sr. Member
Posted: 21 March 2012 08:26 PM   Total Posts: 216   [ # 2 ]

Here’s something to update:

var bmpData:BitmapData getBitmapDatamc );
   
   
material.texture = new BitmapTexture(bmpData);
   
material.alphaBlending true ;
   
   for(var 
i:int 0aMeshes.lengthi++){
     
    aMeshes[i]
.material material;
   

I think you can just set the texture’s bitmapData without creating a new texture on each frame:

TextureMaterial(aMeshes[i].material).texture.bitmapData=bmpData

Not tested code, but something like that.

   

Fab4ce, Jr. Member
Posted: 21 March 2012 08:40 PM   Total Posts: 44   [ # 3 ]

perfect!

Thanks a lot.

   

/\/\/\, Newbie
Posted: 21 March 2012 09:31 PM   Total Posts: 15   [ # 4 ]

excuse my noobish question, but i had a look at Sprite3D and saw that it has a parameter “animation” and “animationState”

are they just fake or can they already be used for anything?

   

Fab4ce, Jr. Member
Posted: 21 March 2012 10:01 PM   Total Posts: 44   [ # 5 ]

good question… i don´t know…

but here is the optimized code, suggested by Alex Bogartz

var bmpData:BitmapData getBitmapDatamc );
for(var 
i:int 0aMeshes.lengthi++){

BitmapTexture
(aMeshes[i].material.texture).bitmapData=bmpData;  
   

datouaizi, Member
Posted: 03 April 2012 09:23 AM   Total Posts: 98   [ # 6 ]

thanks first, but i have a question.  why mc doesn`t play?

   

Fab4ce, Jr. Member
Posted: 03 April 2012 07:42 PM   Total Posts: 44   [ # 7 ]

hi.

Simply use one of these lines in your enterFrame render loop:

// call the playOn method in your render loop and pass in an array of your meshes
timelineAnimation.playOn(arrayHotspots);

// or if you have only 1 mesh
timelineAnimation.playOn([animatedSprite3D]); 
   

datouaizi, Member
Posted: 20 May 2012 06:10 PM   Total Posts: 98   [ # 8 ]

private function onEnterFrame(event:Event):void
{
  view.render(); 
  if(playVent)
  {   
    ventTagM.playOnArray(vent_arr);
  }
}

mc`s animation is arrow moving a far distance like 10cm,but in away3d only move 2cm;

why?

   

CapRoberts, Newbie
Posted: 27 February 2013 08:54 PM   Total Posts: 2   [ # 9 ]

Have not been able to get this up and running, would you be so kind and upload an example project using the class? Might be just what I need, as I am trying to mirror on a 3d model changes done within a movie clip. Got this working with away3d 3.6 and the MovieClip material. But it would be nice to switch to away3d 4 to be able to use some of the more advanced features.
Learning something new every day and might eventually work this out and how to use it in a project, but for now not experieced enough and a sample movie would help.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X