Panel animation movement
-
@Matt_SF
Uhm..
Does yours move backwards after reaching the final point? -
@Sawer I just got it to move but if you want to move it back and forth you have to create another variable which holds the direction of the panel and change the direction when the panel reaches the value you want.
Try this :
HiseSnippet 931.3ocsV0saaaCElzIrnRaEXEXO.B4JEzl.4z1kBTTL23jL3skTg4tfsq5XjnsHhDo.EcSMJBvdN1E6YYOR6Mn6PR8mScFFLVMfMz4mOxuC024PGqjIrpJoBg8dyxRFB+kjoKE5rwYTt.M4XD99jXEqhoQGsrjVUwRQX7VemIJ1aaj8ye+sGQyohDVmKD5BIOg8i7Bttya7nefmmeJMk8FdQure5nIIRwXYtbAvjsHQnRZxUz4ryolzFPP36cRJWKUS0TMqBg29HY5xoYxqEt7ufWwuLmYLFhlBKjy8ox7TCiMdQiy34owMUbEBVk3t5eKW8+0jy3o7V+cmCekMPPGh9mG3AqRusVgdC6SundzaMTB2iRa6nzCISST7RcWDCe9BxDglolQgi89TwkKZveLfLVBYHz6WPuhcpBLZQD9rnnGG.+r6K788gy9Jcv6npfRQ9qD7fWFz.cNSOVVTJEfQ3Ntv6.f5fDSEr7g2IDWXCjZLYL97LMj+vCO7E9J17fTthkn4RAjiaG1GzawxJtwYHPTKWMeszsKGiJRMllmeIHWBmsPXWlvc8+fumsbjU+JrS0..hEtyRCU7783yBBcgeYPzt9ddsr..DAovxqXA8yxQ7am5v1Uqm25kzf7QOpdsps2aOvFPr1B0tU8pUOcFuZeEqDDg5PvwMv2lxLPJNWpYuttdaVPMU4NWBehYItwO31.lM6VHjkN.eR5lWoJYdtIlAwsBWiZMQpAFJVTbIS8XPnjuf0lHnrWscgb2sK86lSbJrdIJESDb8qKYh6pGGUKKgm94IGS0TSOVsOHuRlRyMT.eL6cv.KWGmG4XV0Uv4hM2ZsLLCRai9fl9QizFwSsyHsxbz66OAbYqwuewnq4o5rVG+1MibxoVO+U9nU1Ku6dubu2L6EAWuOD7eBOTuGD7AfQy56r3ZVQy7Uu688We1GQq38f9tKoJfC8HSa8g9zoSvbQY5hbpd0gklaHpC.RhUlPYlBI.M+x92f7+1Dz+qT7gjXtNIa8bbvZ3HHb9bvw56cd.4jYyf4GcDbaxo+xmmKYP+jbglKleFUq3FYz4KJlBhfDFr6B3EsokDOvz73riZjZSYhTqwGgO0AGZrw0AG1DDUPSTx2l3FDXtY69VO.mD1K08HmYrCFhrCG.bjn8iPEvkruMIwT96A5s0i4fM.yS1.LOcCv7rM.y2rAXNbCv77+ULl+eyqVnkEt1AvQ7I1IlX7IBJnrrpPz+.CNAw0B
-
@Matt_SF Ok thanks.
Will try the snippet in a bit. -
@Matt_SF Man it works!!!
Will compare the code and give feedback on where I messed up. Thanks so much man!! -
-
@Matt_SF Hello man.
Thanks again for the snippet.
Trying to figure out how and why you got it right and what was missing on my side. I tried iterating through your code to understand it, but I'm still not getting it.const var pnlAni = Content.getComponent("pnlAni"); const var Panel1 = Content.getComponent("Panel1"); pnlAni.setPosition(0, 0, 50, 50); pnlAni.setTimerCallback(function() { var posY = pnlAni.get("y"); if (posY == 0) posY++; else if (posY == 177) posY--; pnlAni.setPosition(0,posY , 50, 50); this.repaint(); });
This is what I created based on your working snippet. It's not working and I'm not understanding why. Based on my logic, I think this code is right (which is totally not), and I want to understand why I think this is. What am I missing here?
-
@Sawer look at your code:
if posY == 0 -- do something...
if posY == 177 do something...So assuming posY == 0 the first time, what happens then? and what does posY ==?
-
@Lindon It does nothing. Because is neither equal to 0 or 177. True, thanks..
-
@Sawer said in Panel animation movement:
@Lindon It does nothing. Because is neither equal to 0 or 177. True, thanks..
correct so try this:
var summingValue = -1; pnlAni.setTimerCallback(function() { var posY = pnlAni.get("y"); if (posY == 0) summingValue = 1; if (posY == 177) summingValue = -1; posY = posY + summingValue; pnlAni.setPosition(0,posY , 50, 50); this.repaint(); });
-
@Lindon I would never have thought of doing it like this. Nice
-
@Lindon Thanks so much for the explanation and the new code!