Skip to content

Commit

Permalink
UPDATE automatic limits update
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasKulhanek committed Feb 28, 2022
1 parent 06b8043 commit 90ea98f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/elements/animate-adobe-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ export class AnimateAdobeControl {
console.log('animateadobecontrol startstop()', this);
this.animationstarted = ! this.animationstarted;
let eventname;
if (this.animationstarted) eventname = 'animatestart';
if (this.animationstarted) {
if (window.ani) window.ani.enableAnimation();
eventname = 'animatestart';
}
else eventname = 'animatestop';
let event = new CustomEvent(eventname, {detail: {time: this.frame}}); //send start signal on frame 0
//dispatch event - it should be listened by some other component
Expand Down
2 changes: 1 addition & 1 deletion src/elements/animate-adobe.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export class AnimateAdobe {
if (window.ani && window.ani.animobjs) window.ani.animobjs = null;
if (window.ani && window.ani.textobjs) window.ani.textobjs = null;
if (window.ani && window.ani.playobjs) window.ani.playobjs = null;
if (window.AdobeAn) window.AdobeAn = null;
//if (window.AdobeAn) window.AdobeAn = null;
}

removeScript(source) {
Expand Down
2 changes: 2 additions & 0 deletions src/elements/animate-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export class AnimateControl {
document.getElementById(this.id).dispatchEvent(event);
} else {
//this.animationstarted = true;
if (window.ani) window.ani.enableAnimation();
let that = this;
//console.log('startstop() animate using requestAnimationFrame');
//animate using requestAnimationFrame
Expand Down Expand Up @@ -188,6 +189,7 @@ export class AnimateControl {
this.astep = adif / sdif;
}
//console.log('BdlAnimateControl segment() astep', this.astep);
if (window.ani) window.ani.enableAnimation();
let event = new CustomEvent(this.eventprefix + 'start', {detail: {time: this.frame}});
document.getElementById(this.id).dispatchEvent(event);
}
Expand Down
5 changes: 3 additions & 2 deletions src/elements/bind2animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class Bind2animation {
if (this.autofmin) {
//initially sets minimum as 1/2 of current value, otherwise update it
if (!this.afminset) {
this.fmin = x/2;
this.fmin = x*0.9;
this.afminset = true;
this.updateK();
} else {
Expand All @@ -58,7 +58,7 @@ export class Bind2animation {
if (this.autofmax) {
//initially sets maximum as 2x of current value, otherwise update it
if (!this.afmaxset) {
this.fmax = x*2;
this.fmax = x*1.1;
this.afmaxset = true;
this.updateK();
} else {
Expand All @@ -74,6 +74,7 @@ export class Bind2animation {
}

updateK() {
console.log('bind2animation updateK() aname'+this.aname+' min:'+ this.fmin+ ' max:'+this.fmax);
this.k1 = (this.fmax !== this.fmin) ? (1 / (this.fmax - this.fmin)) : 0;
this.k2 = (this.fmax !== this.fmin) ? (this.fmin / (this.fmax - this.fmin)) : 0;
}
Expand Down

0 comments on commit 90ea98f

Please sign in to comment.