Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animating scaling with Tween not working #1816

Closed
l-portet opened this issue May 26, 2020 · 5 comments
Closed

Animating scaling with Tween not working #1816

l-portet opened this issue May 26, 2020 · 5 comments

Comments

@l-portet
Copy link

Description/Steps to reproduce

I want to animate the scaling property of a path but it doesn't seem to work with Tween.
But on other properties like fillColor or scaling it works perfectly.

Link to reproduction test-case

JSBin Demo

Expected result

The red circle should be animated to scale from 0% to 100%.

Additional information

Tested on Google Chrome 81

@lehni
Copy link
Member

lehni commented May 26, 2020

I noticed the same problem also recently. When you start with 0, scaling can't grow somehow. Start with something very small, close to 0, and it should work. But when using Path.Circle, make sure to also turn of applyMatrix, or use Shape.Circle instead:

window.onload = function () {
      let canvas = document.getElementById('myCanvas');
      paper.setup(canvas);
      let path = new paper.Path.Circle({
          radius: 40,
          center: new paper.Point(50, 50),
          applyMatrix: false
      });

      path.fillColor = 'red';
      path.scaling = 1
      
      // Comment this part and it will show the red circle
      path.tween(
          { scaling: 0.0001, fillColor: 'blue' },
          { scaling: 1, fillColor: 'purple' },
          { duration: 1500 }
      );
      // Uncomment this one to see it works on animating fillColor
      /*
        path.tween(
          { fillColor: 'blue' },
          { fillColor: 'purple' },
          { duration: 1500 }
      );
      */
  };

The fact that scaling = 0 doesn't work is a bug.

@lehni
Copy link
Member

lehni commented May 26, 2020

Sketch Version

@l-portet
Copy link
Author

I put scaling at 0 for the example, but my real mistake was to forget to set applyMatrix to false, thanks for your reactivity!

@lehni lehni reopened this May 27, 2020
@lehni
Copy link
Member

lehni commented May 27, 2020

Reopening since scaling = 0 is still a bug ;)

@lehni
Copy link
Member

lehni commented May 27, 2020

That bug isn't actually linked to the use of tweening. It can be simplified to this scenario:

Sketch

@lehni lehni closed this as completed in 77886f9 May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants