HI,
i don't understand how can i dynamic update values on tween:
Example in attach.
Code:
$(function () {
var tween = new TimelineMax({paused: true}),
box = $('.box'),
leftBtn = $('.btn-left'),
rightBtn = $('.btn-right'),
direction = '-',
distance = 500,
value1= direction + '=' + distance;
function directionMove(playk) {
if (playk == 'playk') {
direction = '-';
value1 = direction + '=' + distance; // how to update value
tween.play();
}
else if (playk == 'reversk') {
direction = '+';
value1 = direction + '=' + distance; //how to update value
tween.play();
}
}
tween
.to(box, 15, {css: {x: value1}, ease: Linear.easeNone}); // no need move by default
leftBtn.on({
click: function () {
directionMove('playk');
}
});
rightBtn.on({
click: function () {
directionMove('reversk');
}
})
});
I want update value1 dynamic (on this example: onClick). I can find solution, can you help me,
Thanks!