Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
Adding my own easing functions to javaScript library (Paper.js)

I want to extend the Paper.js library (https://github.com/paperjs/paper.js) to add my own easing functions. The full source code of the library is here: https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.12.15/paper-full.js.

However, the relevant part is this:


var Tween = Base.extend(Emitter, {
    _class: 'Tween',

    statics: {
        easings: new Base({
            linear: function(t) {
                return t;
            },

            easeInQuad: function(t) {
                return t * t;
            }
        })
    },
// More code

I know I can create a local copy of the entire source code and make the changes to the file locally to add my own custom easing functions. However, I wanted to know if there is any way to add my own easing functions without changing the original library and making changes to the other file.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You don't even have to do this because Paper.js accepts custom easing functions.
So you simply have to pass your custom easing function when creating the Tween.
Here's a simple sketch demonstrating this.

new Path.Circle({
    center: view.center,
    radius: 50,
    fillColor: 'yellow'
}).tweenTo(
    { fillColor: 'red' },
    {
        duration: 2000,
        easing: function(t) {
            return t;
        }
    }
);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!