-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Timeline transform element property multiple times with relative value #121
Comments
Actually the behavior of animating a property multiple times with absolute value is also unexpected. In the above example, if I'd replace with Lmk if this is a bug or design. I can imagine there being some performance benefits of not doing this at execution time. |
And another related issue here: |
v2.0.2 will fix this, currently in beta here https://github.com/juliangarnier/anime/tree/v2.0.2. |
To make things easier, I created a branch to work on the timeline bugs / improvements. I made some changes that should fix the relative transform values on the same target, fix the You can try it here : https://github.com/juliangarnier/anime/tree/v2.0.2-TL |
@juliangarnier, keep in mind that v2.0.2-TL breaks the behavior above, just in a different direction (sort of). I'll try to find some time to take a look at the code. Until then, all 3 versions (v2.0.1, v2.0.2, v2.0.2-TL) - respectively: |
Can you share the code used in this example? Thanks |
Sure thing: /**
* Cube
*/
const THREE = require('three')
const anime = require('../vendor/anime/anime.js')
// const anime = require('animejs')
var scene, camera, renderer, cube, floor
function init() {
var ww = window.innerWidth,
wh = window.innerHeight
scene = new THREE.Scene()
camera = new THREE.OrthographicCamera( ww / - 2, wh / 2, wh / 2, wh / - 2, 1, 1000 )
camera.position.set( 500, 500, 500 )
camera.lookAt(scene.position)
renderer = new THREE.WebGLRenderer({ antialias: true })
renderer.setSize( ww, wh )
renderer.setClearColor( 0x292c33, 1 )
renderer.setPixelRatio( window.devicePixelRatio )
document.body.appendChild( renderer.domElement )
var cubeGeometry = new THREE.BoxGeometry(50, 50, 50)
var cubeMaterial = new THREE.MeshLambertMaterial({color: 0xffffff, shading: THREE.FlatShading})
cube = new THREE.Mesh(cubeGeometry, cubeMaterial)
scene.add(cube)
var light = new THREE.DirectionalLight( 0xffffff, 1.8 )
light.position.set( 60, 100, 20 )
scene.add(light)
anime.timeline({
loop: true
})
.add ({
targets: cube.scale,
x: 2,
duration: 500,
easing: 'easeOutExpo'
})
.add ({
targets: cube.scale,
z: 2,
duration: 500,
easing: 'easeOutExpo'
})
.add ({
targets: cube.scale,
y: 2,
duration: 1000
})
.add ({
targets: cube.scale,
x: 1,
y: 1,
z: 1,
duration: 700,
easing: 'easeOutExpo'
})
.add ({
targets: cube.rotation,
y: ( - Math.PI ),
duration: 500,
easing: 'easeOutExpo',
offset: '-=700'
})
}
function render() {
requestAnimationFrame(render)
renderer.render(scene, camera)
}
init()
render() |
Hoo ok, the problem occurs after the first loop. |
With v2.0.2-TL the cumulative translateX animations on timeline work nicely.
But v2.0.2 and v2.0.2-TL did break behavior which worked before, with non-numerical
This works fine on master, on v2.0.2 branches it just fills with Thanks! |
The last commit should fix the loop issue. You're right about the Let me know if it works for you that way. Regarding the Can you share the full SVG and JS code concerning this issue? Thanks! |
I made a MWE here: http://codepen.io/tsercu/pen/RpJEVX |
It should breaks since animation between non-numerical values like |
On the canary branch, this all works for me now. |
I re-tested all of this, and everything looks fine. |
I am not following all the technical details described above (JavaScript newbie), but I think I encounter the same issue. I would like to move shapes around randomly, so make a random translation again and again, but not returning to the initial value:
It seems like you guys have a solution to this issue, would it be possible to lay that out for me once again in simple steps? Thanks in advance! (+ Beautiful library & documentation!!) |
I just discovered anime.js for a svg animation project, so first off: thanks for this great library which fits my need exactly!
I ran into the problem with animating the same element property multiple times with relative values.
I'd expect these relative transforms to be cumulative, but instead they restart from the same initial state.
Not sure if this is design or a bug, but in my opinion this takes away a lot of the value of relative transforms. With the velocity framework,
$.Velocity.RunSequence()
chains relative transforms in a cumulative way.The text was updated successfully, but these errors were encountered: