Jump to content

Drawing circle / tweening and anchor issue


Ninjadoodle
 Share

Recommended Posts

Hi @enpu

I'm trying to draw a circle and animate it. I can't seem to be able to set its anchor.

By default, it seems like it's anchor is near it's middle, but I thin there might be a bug somewhere.

var bgCircle = new game.Graphics();
bgCircle.drawCircle(640, 960, 720);
//bgCircle.anchorCenter();
bgCircle.alpha = 0.25;
bgCircle.addTo(game.scene.fg);

game.Tween.add(bgCircle.scale, {
    x: 0.95,
    y: 0.95
}, 1000, {
    easing: 'Quadratic.InOut',
    repeat: Infinity,
    yoyo: true
}).start();

 

Link to comment
Share on other sites

If your Graphics object has only one shape, you should draw it at position 0,0 and then change the position of the Graphics object.

var bgCircle = new game.Graphics();
bgCircle.drawCircle(0, 0, 720);
bgCircle.position.set(640, 960);
bgCircle.alpha = 0.25;
bgCircle.addTo(game.scene.fg);

 

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...