better doleance transition #2233

This commit is contained in:
Bachir Soussi Chiadmi 2024-01-12 11:10:42 +01:00
parent 89889df66c
commit 9d36ed7941
3 changed files with 43 additions and 32 deletions

View File

@ -703,7 +703,9 @@ body{
&.animeleft, &.animeleft,
&.animeright{ &.animeright{
// animation-duration: 1.5s; // animation-duration: 1.5s;
transition: opacity 1s ease-in-out,transform 1s ease-in-out; $duration: 0.9s;
$delay: 0.4s;
transition: opacity $duration ease-in-out $delay,transform $duration ease-in-out $delay;
opacity: 0; opacity: 0;
} }
&.animeleft{ &.animeleft{

View File

@ -1627,33 +1627,37 @@ export default {
to_pg.opacity = 0; to_pg.opacity = 0;
let bg = this.paper_main_object.children.doleance_bg; let bg = this.paper_main_object.children.doleance_bg;
// fade out the current visible cercle politique then fade in the new one // // fade out the current visible cercle politique then fade in the new one
let u = 0; new Tween.Tween({o: 1})
let f = 6; .to({
let p = 10; o: 0
let doDoleanceTransition = function(){ }, 600)
// console.log(`doDoleanceTransition u:${u} from:${from_pg}, to:${to_pg}`); .onUpdate((obj) => {
u++ console.log(`tween update. o=${obj.o}`);
if (u <= f*2+p) { from_pg.opacity = bg.opacity = obj.o;
if (u<=f) { })
// fade out .onComplete((obj) => {
from_pg.opacity = bg.opacity = 1-u/f new Tween.Tween({o: 0})
} else if(u>f && u<p+f) { .to({
// pause o: 1
}else{ }, 900)
// fade in .onUpdate((objb) => {
to_pg.opacity = bg.opacity = (u-p-f)/f to_pg.opacity = bg.opacity = objb.o;
} })
window.requestAnimationFrame(doDoleanceTransition); .onComplete((obj) => {
}else{ from_pg.visible = false;
from_pg.visible = false; from_pg.opacity = 1;
from_pg.opacity = 1; to_pg.opacity = 1;
to_pg.opacity = 1; this.doleance_transition = false
this.doleance_transition = false })
} .delay(500)
}.bind(this) .easing(Tween.Easing.Quadratic.InOut)
.start();
})
.easing(Tween.Easing.Quadratic.Out)
.start();
doDoleanceTransition()
} }
}, },
onIsHover(){ onIsHover(){
@ -2122,9 +2126,10 @@ export default {
onBeforeEngineUpdate (event) { onBeforeEngineUpdate (event) {
// update the opening/closing tweening // update the opening/closing tweening
if (this.tween) { // if (this.tween) {
this.tween.update(); // this.tween.update();
} // }
Tween.update();
if (this.opened_concernement) { if (this.opened_concernement) {
// console.log("try to push aside", this.opened_concernement.opened_mapitem_id, this.id, this.opened_concernement.superposed_mapitem_id_by_mapitem_id[this.opened_concernement.opened_mapitem_id]); // console.log("try to push aside", this.opened_concernement.opened_mapitem_id, this.id, this.opened_concernement.superposed_mapitem_id_by_mapitem_id[this.opened_concernement.opened_mapitem_id]);

View File

@ -53,6 +53,10 @@ export default {
if (this.doleance_index < this.concernement.doleances.length-1) if (this.doleance_index < this.concernement.doleances.length-1)
this.$refs.nextDoleanceBTN.classList.add('visible'); this.$refs.nextDoleanceBTN.classList.add('visible');
}, },
unmounted() {
this.setOpenedDoleance(parseInt(this.cid), this.concernement.doleances[0].id);
},
methods: { methods: {
...mapActions(ConcernementsStore,['setOpenedDoleance']), ...mapActions(ConcernementsStore,['setOpenedDoleance']),
nextDoleance(){ nextDoleance(){
@ -80,7 +84,7 @@ export default {
that.$refs.nextDoleanceBTN.classList.remove('animeleft', 'animeright'); that.$refs.nextDoleanceBTN.classList.remove('animeleft', 'animeright');
that.$refs.nextDoleanceBTN.classList.toggle('visible', that.doleance_index < that.concernement.doleances.length-1); that.$refs.nextDoleanceBTN.classList.toggle('visible', that.doleance_index < that.concernement.doleances.length-1);
}; };
}(this)), 1000) }(this)), 2000)
} }
}, },
components: { components: {