REVISED2: I'm encountering an issue with converting images to canvas using Pixastic in HTML5. How can I 'return' this converted image back to a global variable? Any suggestions?
<img id="mainIllustration" alt="main illustration" src="Img/Model01.png">
Illust...o_03.js (line 24)
<canvas id="mainIllustration" class="" width="278" height="659" style="" title="" tabindex="-1">
Illust...o_03.js (line 32)
<img id="mainIllustration" alt="main illustration" src="Img/Model01.png">
Illust...o_03.js (line 24)
<canvas id="mainIllustration" class="" width="278" height="659" style="" title="" tabindex="-1">
Illust...o_03.js (line 32)
<img id="mainIllustration" alt="main illustration" src="Img/Model01.png">
Illust...o_03.js (line 24)
<canvas id="mainIllustration" class="" width="278" height="659" style="" title="" tabindex="-1">
REVISED 1: It seems that the issue lies with Pixastic manipulating the image and not returning it to the global image variable (eMainIllustration). Any advice on how to solve this problem?
UPDATED MESSAGE:
Hello everyone,
I am working with the Pixastic library and facing confusion regarding global and local variables.
Below are two sets of code, one where the variable is globally defined as desired and another where it is locally defined.
The first code snippet works fine with the locally defined variable eMainIllustration and the function functions properly.
var eDisplayTableSlideState = false;
function displayTableSlideIn()
{
var eMainIllustration = document.getElementById("mainIllustration"); // eMainIllustration is locally defined
if (eDisplayTableSlideState === false)
{
$("#displayTable").animate ({top: "-=33px", left: "+=66px", width: "-=198px", height: "-=48px"}, 750, "swing",function()
{
Pixastic.process (eMainIllustration,"blurfast", {amount: 0.1});
return (eDisplayTableSlideState = true);
});
} else
{
$("#displayTable").animate ({top: "+=33px", left: "-=66px", width: "+=198px", height: "+=48px"}, 500, "swing",function()
{
Pixastic.revert(eMainIllustration);
});
return (eDisplayTableSlideState = false);
}
}
However, when the variable eMainIllustration is set globally, the code within the 'else' part of the function does not work. Why is that?
// eMainIllustration is locally defined
var eMainIllustration = document.getElementById("mainIllustration");
var eDisplayTableSlideState = false;
function displayTableSlideIn()
{
if (eDisplayTableSlideState === false)
{
$("#displayTable").animate ({top: "-=33px", left: "+=66px", width: "-=198px", height: "-=48px"}, 750, "swing",function()
{
Pixastic.process (eMainIllustration,"blurfast", {amount: 0.1});
return (eDisplayTableSlideState = true);
});
} else
{
$("#displayTable").animate ({top: "+=33px", left: "-=66px", width: "+=198px", height: "+=48px"}, 500, "swing",function()
{
Pixastic.revert(eMainIllustration);
});
return (eDisplayTableSlideState = false);
}
}
Could the issue be related to not returning the state of the changed eMainIllustration in the first half of the function? How can I resolve this?
Thank you,