Sign in to follow this  
jakubdev

What's better aproach to stop specified ticker in functional project.

Recommended Posts

Hello,

I'm trying to stop one of tickers which animate text. As app.ticker can be removed when he knows function location in memory so I used atm hack to make it work.  Allocating pulsateText function in arrow function to know exacly his location,but it makes unnecessary code. How can i achieve that easier? 

 

Quote

export const finishLoading = (app, loader, resources) => {
    const tapAnywhereText = new PIXI.Text('Tap anywhere to start...', {
        fontFamily: 'Roboto',
        fontSize: 24,
        fill: 0xFFFFFF,
        align: 'center'
    });
    tapAnywhereText.x = window.innerWidth / 2 - tapAnywhereText.width / 2
    tapAnywhereText.y = window.innerHeight - window.innerHeight / 4 + 40;
    tapAnywhereText.name = 'tapAnywhereText';

    const forFunctionAddress  =  () => pulsateText(tapAnywhereText)

    app.ticker.add(forFunctionAddress, forFunctionAddress);


    app.view.onpointerdown = (event) => {
        startGame(app,forFunctionAddress)
    };

    app.stage.addChild(tapAnywhereText);
}

export const cleanLoadingTextures = (app, forFunctionAddress) => {
    app.ticker.remove(forFunctionAddress, forFunctionAddress);
}

 

Share this post


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.
Note: Your post will require moderator approval before it will be visible.

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.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.