Jump to content
Search Community

Pixel shift when using 3d rotation

friendlygiraffe test
Moderator Tag

Recommended Posts

Essentially no, this isn't a tweenable effect. matrix3D is a property, just like x or alpha, so it's either on (is a matrix3D - bitmap mode) or off (is null - vector mode).

 

That said, to get a smoother transition from bitmap to vector you could write a function to fade between the bitmap and the vector:

* capture mc as a bitmapdata

* create a bitmap from the bitmapdata

* addChild(bitmap) somewhere and position it to exactly overlay mc (could be the stage, mc.parent, or mc itself - you can figure out how this works best for you - as a child of mc you could continue to tween simpler values like x and alpha with no side effects)

* set mc.transform.matrix3D to null

* tween the alpha of bitmap to 0

* removeChild(bitmap)

 

This could be facilitated with a plugin probably, however I don't work with flash much anymore so I don't have an environment to write this up and test it out for you. If plugin development is not for you, you could just make it a standalone function to call onComplete.

Edited by jamiejefferson
Link to comment
Share on other sites

Here's the solution (sort of). With help of Carls code:

 

import com.greensock.*;
import com.greensock.easing.*;
import flash.display.DisplayObject;
import flash.geom.Rectangle;
import flash.display.MovieClip;
var mcs:Array = [mc1,mc2,mc3];
TweenMax.staggerFrom(mcs, 1, {delay:1,rotationX: "130",y:"-200", onComplete: deBlur, onCompleteParams: ["{self}"]}, 0.05);
function deBlur(tween:TweenMax)
{
var mct:MovieClip = tween.target as MovieClip;
var currentX:Number = mct.x;
var currentY:Number = mct.y;
var myBitmapData:BitmapData = new BitmapData(mct.width,mct.height,true,0x000000);
myBitmapData.draw(mct);
var bmp:Bitmap = new Bitmap(myBitmapData);
bmp.x = currentX;
bmp.y = currentY;
this.addChild(bmp);
mct.transform.matrix3D = null;
var fadeTime:Number = 0.5;
TweenMax.to(bmp,fadeTime,{alpha:0});
TweenMax.from(mct,fadeTime,{alpha:0});
mct.x = currentX;
mct.y = currentY;
}

Link to comment
Share on other sites

Wow you got that sorted quickly :-P

 

Question though, is the TweenMax.from(mct,fadeTime,{alpha:0}); necessary? I'd imagine this sort of effect would involve a dip in total opacity for mct, as during the tween neither mct or bmp have alpha:1; although combined alpha will be high throughout, it is probably less than 1 (try increasing the fadeTime to see if it becomes more obvious). If bmp has a higher index than mct, just fading it out should be enough to transition from bmp to mct.

 

Try this and see if it improves at all:

TweenMax.to(bmp,fadeTime,{alpha:0});
TweenMax.from(mct,fadeTime,{alpha:0});

// replace with:

TweenMax.to(bmp,fadeTime,{alpha:0, onComplete:removeChild, onCompleteParams:[bmp]});

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...