开发者

Problem tweening MC slow movement with Tweener, even with smoothing

开发者 https://www.devze.com 2023-03-05 08:48 出处:网络
I think that Tweener is not using fractions of pixels on x,y movement, but that exactly what I need. I read about rounded parameter (default:false), that would round pixels, to reduce problems with te

I think that Tweener is not using fractions of pixels on x,y movement, but that exactly what I need. I read about rounded parameter (default:false), that would round pixels, to reduce problems with text, but I want to slowly pan an loaded image, so I don't want to use a rounded value. My code:

var bmp = Bitmap(loader.content);
bmp.smoothing = true;
Tweener.addTween(loader, {x: 20.0, time:10, transition:"linear"});

Image smoothing works fine, but it slides choppy. It looks like moving 1 pixel at seldom frames, not some fraction of px per frame. I'm considering that flash image smoothing has to deal with fraction of pixels. I searched over stackoverflow, and all I could find was about imag开发者_StackOverflow中文版e smoothing, and not about x,y movement smoothing.

Thanks in advance.


If loader.content contains a Bitmap instance, that is your problem. Bitmap automatically snap to a full pixel unlike MovieClip and Sprite. You can change this behavior by setting the pixelSnapping property.


If it's choppy only on certain, infrequent frames, it could be the garbage collector doing a sweep in the middle of your movement and causing a slight stutter in performance.


I solved this by changing x,y movement to a scaleX and scaleY "movement". As I was using a mask over a big photo, it looks like moving when I scale the photo, but it actualy is scaling.

I know this is not a good answer, but it temporarily solved my problem, since I didn't realy now why in this specific case x,y movement was not smooth. Maybe helps someone with same problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号