spritely

Change spState when direction change in spRandom

六月ゝ 毕业季﹏ 提交于 2019-12-11 18:59:12
问题 another swimming fish question ;-) Is there a way to detect the direction in which spRandom is currently moving ? So that I can change the spState of my sprite from 1 to 2. if direction=left spState(1) -> Fish faces left if direction=right spState(2) -> Fish faces right Hope you understand my question. I did not post any example code yet. Hope anyone can give me a generic example of how to do that. Thanks and greetz, Arno. 回答1: You can always get the position of the element: $('#bird')

Moving an image randomly around a page

徘徊边缘 提交于 2019-11-29 14:19:45
问题 I created three .png images of hot air balloons. Each are different sizes so that they give off the idea of "depth." What is the best way to code these .png's so that they move and float around my container like hot air balloons? I've tried the following code from the Spritely website which I adapted as so: $('#balloon1') .sprite({fps: 3, no_of_frames: 1}) .spRandom({ top: 70, left: 100, right: 200, bottom: 340, speed: 10000, pause: 3000 }); I put this code for the other two balloons (