storkCore

Diff
Login

Diff

Differences From Artifact [b8e9427dca]:

To Artifact [83871544d8]:


86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

PoeModel.mood = "breathing";


var PoeViewController = clone(StorkHtmlView);

// How much variation there is in Poe's hexes' screen position movement delay (seconds)
PoeViewController.movementDelayVariation = 2.0;

PoeViewController.animationTime = 6;
PoeViewController.animationVarianceTime = 4;
PoeViewController.animationDelayVariance = 1;

// HTML prototype element for a Poe 
PoeViewController.bodypartProto = null;
PoeViewController.bodyArea = {
    left: 0,
    top: 0,
    width: "100%",







|

|
|
|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

PoeModel.mood = "breathing";


var PoeViewController = clone(StorkHtmlView);

// How much variation there is in Poe's hexes' screen position movement delay (seconds)
PoeViewController.movementDelayVariance = 0.4;

PoeViewController.breathingDurationMin = 2;
PoeViewController.breathingDurationVariance = 3;
PoeViewController.breathingDelayVariance = 1.0;

// HTML prototype element for a Poe 
PoeViewController.bodypartProto = null;
PoeViewController.bodyArea = {
    left: 0,
    top: 0,
    width: "100%",
122
123
124
125
126
127
128
129
130
131
132





133
134
135
136
137
138
139

/**
 * Generate a random transition delay that can be set for each body part
 * to make them feel a bit more organic.
 */

PoeViewController.movementTransitionDelay = function() {
  let delay = Math.random() * this.movementDelayVariation;
  return delay + "s";
}







PoeViewController.attach = function(parent) {
    this.superMethod(PoeViewController.attach, "attach", parent);
    this.breathingElements = [];
    this.locatorElements = [];
    
    if ( (this.model != null) && (this.bodypartProto != null)  &&







|



>
>
>
>
>







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144

/**
 * Generate a random transition delay that can be set for each body part
 * to make them feel a bit more organic.
 */

PoeViewController.movementTransitionDelay = function() {
  let delay = Math.random() * this.movementDelayVariance;
  return delay + "s";
}


PoeViewController.breathingTransitionDelay = function() {
  let delay = Math.random() * this.breathingDelayVariance;
  return delay + "s";
}

PoeViewController.attach = function(parent) {
    this.superMethod(PoeViewController.attach, "attach", parent);
    this.breathingElements = [];
    this.locatorElements = [];
    
    if ( (this.model != null) && (this.bodypartProto != null)  &&
150
151
152
153
154
155
156
157
158
159
160
161
162
163





164
165
166

167
168
169
170
171
172
173
                getElementFromStorkID(locatorElement, "PoeBody-",
                                      this.bodypartID,
                                      i);
            breathingElement.style.opacity = "0.5";
            breathingElement.style.top = i * 10 + "px";
            breathingElement.style.left = i * 10 + "px";
            breathingElement.style.transitionDelay =
                this.movementTransitionDelay();
            breathingElement.style.transitionDuration =
                (Math.random() * this.animationDurationVariance +
                 this.animationDurationMin) + "s";
            parent.appendChild(locatorElement);
            this.locatorElements.push(locatorElement);
            this.breathingElements.push(breathingElement);





            setInterval(() => {
                this.breathBody();
            }, 6000);

        }
    }
};


PoeViewController.breathBody = function() {
    console.debug("called");







|

|
|



>
>
>
>
>
|
|
|
>







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
                getElementFromStorkID(locatorElement, "PoeBody-",
                                      this.bodypartID,
                                      i);
            breathingElement.style.opacity = "0.5";
            breathingElement.style.top = i * 10 + "px";
            breathingElement.style.left = i * 10 + "px";
            breathingElement.style.transitionDelay =
                this.breathingTransitionDelay();
            breathingElement.style.transitionDuration =
                (Math.random() * this.breathingDurationVariance +
                 this.breathingDurationMin) + "s";
            parent.appendChild(locatorElement);
            this.locatorElements.push(locatorElement);
            this.breathingElements.push(breathingElement);
            this.breathBody();
            // This is here to cause some breathing animation more rapidly
            // than the regular interval below it.
            setTimeout(() => {
                this.breathBody();
                setInterval(() => {
                    this.breathBody();
                }, 6000);
            }, 1000);
        }
    }
};


PoeViewController.breathBody = function() {
    console.debug("called");