GithubHelp home page GithubHelp logo

Comments (1)

camille-hdl avatar camille-hdl commented on June 1, 2024

Hi,

segmentGrow is something I'm not really happy with.

I was looking for a way to animate the drawing of a straight line, so I invented this segmentGrow thing. What it does is that it takes a target Point as value, and adds many small segments to the Path until it reaches said target Point. It kinda works on small Paths, but it's a huge performance hit if you have many Paths animated that way.

Anyway you wanted an example, so there you go:
http://jsbin.com/gafaro/1/edit?js,output

  var line = new paper.Path();
  line.strokeColor = "black";
  line.add(new paper.Point(20,20));
  line.animate({
    properties: {
      segmentGrow: new paper.Point(20,100) // target
    },
    settings: {
      duration: 400,
      complete: function() {
        this.animate({
          properties: {
            segmentGrow: new paper.Point(30,20) // new target
          }
        });
      }
    }
  });

Hope this helps.

Cheers

from animatepaper.js.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.