Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

130
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda