Firefox slows down
Janne

I have seen that when using "wade.drawFunctions.resizeOverTime" and "setTimeout functions" it will slows down browsing and animation in firefox. Animation will be slow and ugly. Is there anything to do about it? Other browsers like chrome and explorer will play everything smooth.

All 4 Comments
Gio

Hi

A couple of things you could try

1. Instead of wade.drawFunctions.resizeOverTime you could use a Path and see if that makes any difference regarding performance in firefox. You shuold be able to achieve exactly the same effect as resizeOverTime.

2. If you are using JavaScript's setTimeout, try using wade.setTimeout instead (or viceversa). Does that make your game's performance better on firefox?

Do you have a test case that we can reproduce to see what's going on? Any more information that you can provide can be helpful

Janne

Thank you for reply.

Do you have some documentation how this path works?
As example I use code like this:

wade.getSceneObject("SceneObject_numero3").getSprite(0).setDrawFunction(wade.drawFunctions.resizeOverTime_(10,10,180,180,0.5, wade.getSceneObject("SceneObject_numero3").getSprite(0).getDrawFunction(), function()
{
  // Someting...
}

 

Gio

What you have should be roughly equivalent to a Path with 2 nodes. You then set an event handler for onPathNode and check if you've reached the end of your path to execute a function.

There is an interface in the editor to do this, but if you want to do this purely in code you'd do it like this:

var p = new Path([
    {
        duration: 0.5,   
        size: {x: 10, y: 10}
    },
    {
        size: {x: 180, y: 180}
    }
]);
_.SceneObject_numero3.setPath(p);
_.SceneObject_numero3.onPathNode = function(data)
{
    if (data.nodeIndex == data.path.getNodeCount() - 1)
    {
        // Something...
    }
}

There's a lot more you can do with Paths, not just linear movement / resizing. A couple of useful links:

Full Path API documentation

Tweening Video Tutorial on Youtube

Janne

Thank you for quick reply! I will check and test Full Path API documentation :)

Post a reply
Add Attachment
Submit Reply
Login to Reply