question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

need help , this qusetion is about fps in pixi.js

See original GitHub issue
        var stats = new Stats()

        document.body.appendChild( stats.dom );

        var app = new PIXI.Application();

        var renderer = PIXI.autoDetectRenderer(window.innerWidth,window.innerHeight);

        document.getElementById('stage').appendChild(renderer.view);

        var stage = new PIXI.Container();

        let sprite = new PIXI.Sprite.fromImage('circlef.png');

        stage.addChild(sprite)

        function update (){
            requestAnimationFrame(update)
            sprite.x +=1
            renderer.render(stage)
            stats.update()
        }

        update()

i set the renderer full of screen , when the screen is large , the fps only have 30 - 33 fps ,but when the screen is small ,the fps can make to 60 fps , why?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
bigtimebuddycommented, Jul 14, 2017

Small note here about your code. Application auto-updates so you don’t need to setup a new requestAnimationFrame. Your example will render twice per frame (which is expensive). To do the sprite.x += 1 bit do this instead:

app.ticker.add(function() { sprite.x += 1; });

You can also watch FPS this way: app.ticker.FPS

0reactions
lock[bot]commented, Feb 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

need help , this qusetion is about fps in pixi.js #4160 - GitHub
i set the renderer full of screen , when the screen is large , the fps only have 30 - 33 fps ,but...
Read more >
Show fps on screen - Pixi.js - HTML5 Game Devs Forum
Is there a simple way to show fps in PIXI.js? ... Time your animation loop and display it anyway you want. ... Hope...
Read more >
javascript - PixiJS - Setting a Fixed Frame Rate - Stack Overflow
JS Ticker uses requestAnimationFrame which will always run at the refresh rate of your monitor (probably 60 fps). If you want 25 then...
Read more >
Render Loop - PixiJS
The first step is to calculate how much time has elapsed since the last frame, and then call the Application object's ticker callbacks...
Read more >
pixi-fps - npm
FPS counter for pixi.js. Latest version: 2.0.1, last published: 4 years ago. Start using pixi-fps in your project by running `npm i ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found