Code Monkey home page Code Monkey logo

Comments (11)

mk965 avatar mk965 commented on June 10, 2024 1

Thanks for your feedback, this is a known issue. #677

from tween.js.

NyaNguyen avatar NyaNguyen commented on June 10, 2024
VID_20240221_211342.mp4

from tween.js.

cleverfrog avatar cleverfrog commented on June 10, 2024

VID_20240221_211342.mp4

Hey @NyaNguyen - is that a cell phone video of a monitor displaying that demo for the flicker - or is that the actual canvas output? It has a cool postprocessing effect :)

from tween.js.

NyaNguyen avatar NyaNguyen commented on June 10, 2024

heh....umm..yeah, it's a cell phone filming the monitor with an overhead light shining on it. The flicker we see if what is actually rendered on the screen. ;D

from tween.js.

trusktr avatar trusktr commented on June 10, 2024

Until we can fix this, a workaround is to create two tweens, one going in the opposite direction, and chain them.

If you intend to only make it bounce back and forth linearly, another option is to simply increment on each frame like this (instead of using Tween.js):

let pos = 0
let direction = 1
function animate(time) {
  if (pos <= 0) direction = 1
  if (pos >= 1) direction = -1

  pos += direction * 5
}

Where you can replace 5 with a magnitude based on time and the previous time (delta time) for example.

from tween.js.

NyaNguyen avatar NyaNguyen commented on June 10, 2024

Oh no, a bandage solution! :P Hey, I decided to take a look at the code. Isn't the fix for this simply to move the following code at the bottom before the return true;?

            // properties transformations
            this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);

Seems to work...

from tween.js.

trusktr avatar trusktr commented on June 10, 2024

If it works and all tests pass, let's do it! Would you like to open a pull request?

from tween.js.

NyaNguyen avatar NyaNguyen commented on June 10, 2024

As I won't really know what I am doing with branches and stuff, I will abstain from doing any of that. ;D

After testing further, the file I edited was tween.umd.js. I simply copied the first this._updateProperties() method call over to the bottom as shown in the screenshot.

Edit

from tween.js.

humodz avatar humodz commented on June 10, 2024

@NyaNguyen

There's two issues with that fix:

  • the _updateProperties call needs to be added before all three returns in .update()
  • the callbacks (onUpdate, onRepeat, etc) will be called with the values of the previous update. The current behavior is for them to be called after the value is updated, which I tried to preserve in my pull request

from tween.js.

humodz avatar humodz commented on June 10, 2024

@trusktr Do you mind taking a look at #678 when you have the time?

from tween.js.

Related Issues (20)

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.