Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit99d891a2e88eb93280b9e0ce31eaca011d105f84 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-11-22 10:25:34 +0200
Committer
 Syndamia <kamen@syndamia.com>
2022-11-22 10:25:34 +0200
Filese138e0173e11bc9f6b4b5dfa60c42102cde452ab
uni-projects-99d891a2e88eb93280b9e0ce31eaca011d105f84.tar
uni-projects-99d891a2e88eb93280b9e0ce31eaca011d105f84.tar.gz
uni-projects-99d891a2e88eb93280b9e0ce31eaca011d105f84.zip
Parent24654eb67a15b11cd1f896840327d411ce354b77 (diff)
[OKG/HWK2] animationData property getting is approximated
1 files changed, 13 insertions, 4 deletions
-rw-r--r--Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html17
diff --git a/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html b/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html
index 2864dbc..3099725 100644
--- a/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html
+++ b/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html
@@ -174,8 +174,9 @@
{
t = Math.floor(t) / 100;
- if (animationData.hasOwnProperty(t)) {
- for (var instr of animationData[t]) {
+ var prop = approxProp(animationData, t);
+ if (prop)
+ for (var instr of prop) {
if (instr[1].constructor === Array) {
executeHooks.push({
start : t,
@@ -203,7 +204,6 @@
});
}
}
- }
const executeLength = executeHooks.length;
for (var i = 0; i < executeLength; i++) {
@@ -303,6 +303,15 @@
return p;
}
+ function approxProp(object, property) {
+ if (object.hasOwnProperty(property))
+ return object[property];
+ var toCheck = property.toFixed(1);
+ if (object.hasOwnProperty(toCheck))
+ return object[toCheck];
+ return null;
+ }
+
/*
* За функции, генериращи обекти
*/
@@ -665,7 +674,7 @@
3, [50, 0, 0], [0, -10, 0], false
]
],
- 5.01: [
+ 5: [
[
3, jotaro,
null,