Jump to content

[2.9.9.79] fxMove weird pixel movement


Recommended Posts

Since the latest RTL alpha the fxMoveby method has a very undesirable side effect. During the tween process the graphic is drawn in the right place. When the tween is complete the image drops by one pixel. See gif for effect. This does not occur in previous SMS 2.2.x.x

 

numberworksnwords.com/cloud/temp/imgdrop.gif

 

 

 

        var FeedbackInst:= tw3image.create(self);
        FeedbackInst.zindex:=2;
        FeedbackInst.setbounds(-19,25,30,30);
        FeedbackInst.OnLoad:=procedure (sender:TObject)
          Begin
            w3_setstyle(FeedbackInst.Handle,'-webkit-transition','opacity 0.5s ease-in'); //webkit
            w3_setstyle(FeedbackInst.Handle,'transition','opacity 0.5s ease-in'); //mozilla
            FeedbackInst.AlphaBlend:=True;
          end;
        FeedbackInst.loadfromurl('res/ballGreen.png');
        FeedbackInst.fxMoveBy(60,0, 1);

 

testimg.sproj

Link to post
Share on other sites

I will look into it, but based on the code you posted above - you are in fact running two effects that will collide.

"webkit transition" is also used by the FX effect methods/classes, so unless the onload transition has finished when the fxMoveBy runs, they could in fact collide and cause problems.

But I will have a look

Link to post
Share on other sites
  • 7 months later...

This bug is still present and a bit irritating.

Here is the code

 

var FeedbackInst:= tw3image.create(self);
     FeedbackInst.loadfromurl('res/ballGreen.png');
     FeedbackInst.setbounds(10,15,30,30);
     FeedbackInst.fxMoveBy(30,0, 0.5);

I have tried it with PNGs and JPGs. Also if you leave out SetBound it will continue to do it. Much older version of SMS did not have this bug but I first noticed in 2.9.9.79

I am hoping the devs can take a look.

BallsMovement.rar

2018-07-22_15-47-07.gif

Link to post
Share on other sites
  • Moderators

Might be a padding problem (2px) related to images. Ask @jarto

a (quick and ugly) workaround if you need a temporary fix is to use the OnFinished method of fxMoveBy (4th parameter) and manually set image-tops to 2 px less.

procedure TForm1.W3Button1Click(Sender: TObject);
begin
     ShiftFeedbackBalls;

     var FeedbackInst:= tw3image.create(self);
     FeedbackInst.loadfromurl('res/ballGreen.png');
     FeedbackInst.setbounds(10,15,30,30);
     FeedbackInst.OnLoad:=procedure (sender:TObject)
      Begin
      //  FeedbackInst.AlphaBlend:=True;
      end;
     FeedbackInst.fxMoveBy(30,0, 0.5, procedure()
       begin FeedbackInst.top := 13; end);
end;

procedure TForm1.ShiftFeedbackBalls;
begin
 for var i := GetChildCount - 1 downto 0 do
     if (GetChildObject(i) is tw3image) then
      begin
        var img := GetChildObject(i) as TW3Image;
        img.top := 15;
        img.fxmoveby(30,0,0.5, procedure()
        begin
          for var j := GetChildCount -1 downto 0 do begin
            var img2 := GetChildObject(j) as TW3Image;
            img2.top := 13;
          end;
        end);
        if img.Left > 190 then img.free;
      end;
end;

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...