Jump to content


  • Posts

  • Joined

  • Last visited


0 Newbie
  1. I have a problem, and can't tell if this is EaselJS or GSAP, but I think answer can be useful for users of GSAP . I'm loading bunch of images, and then trying to rotate them around center, but sometimes it doesn't work, I mean - they are not rotating around center, but 0,0. I'm not sure what I'm doing wrong, could someone help me? I'm loading bunch of images like that: var img_all = 2; cloud1.src = "/images/cloud1.png"; cloud1.onload = imageLoader(img_all); cloud1 = new createjs.Bitmap(cloud1); cloud2.src = "/images/cloud2.png"; cloud2.onload = imageLoader(img_all); cloud2 = new createjs.Bitmap(cloud2) And here is my function that tries to set reg. points after all images will be loaded: var img_comp = 0; function imageLoader(img_all) { img_comp++; if(img_all == img_comp) { cloud1.y = 350; cloud2.x = 400; cloud2.y = 300; cloud1.regX = cloud1.image.width/2; cloud1.regY = cloud1.image.height/2; cloud2.regX = cloud2.image.width/2; cloud2.regY = cloud2.image.height/2; TweenMax.to(cloud1, 30, { rotation: 360, repeat: -1, ease: Linear.easeNone }); TweenMax.to(cloud2, 40, { rotation: 360, repeat: -1, ease: Linear.easeNone }); TweenMax.ticker.addEventListener("tick", draw); } } But still sometimes, they are just rotating around 0,0 instead of center, what can be done better? Regards.
  2. Ok, nevermind there should be "test" not "test()" - this is kind of error that can throw you into the abyss of depair and the next minute you got it . Sorry for premature posting.
  3. I'm propably missing something stupid >_< . My code is very simple: mainTimeline = new TimelineMax( { onComplete: test() } ); mainTimeline.append(TweenMax.from(header,2,{x:-header.width})); Why on earth "test()" function would fire instantly without waiting for tween to end? What am I missing? Regards. Luken
  4. Maybe try this code, I was thinking about this problem and managed to optimize my method greatly but the problem with inaccuracy still exists - try this code http://pastebin.com/L9KuDQkp . Often it works ok, but sometimes it ends up really bad, and it's definitely also lag-related, because if you will move your window rapidly, the outcome will be disastrous. So it looks too risky for practical use. Also note that if you will use ONLY last motion, the outcome will be perfect in any case, even if you will create a lag. So the problem lies in switching between motions. Regards .
  5. Ok, I'm sorry if I didn't explain this clear enough. The goal is to be able to have multiple timelines, of motions of the same objects, and to be able to switch between them, play one after another, and also stop one in the middle of motion, and then start another - and all that with accurate outcome (so if theoretically the items would end up in line, in process of many different motions, it would happen practically). Is this possible? Once more sorry for bad explaining, and thanks for trying to help ^^ .
  6. Ok, so I will describe better . I have one class - CVectorAnimator, and few classes with animation effects, which essentially just tweens in various way a vector of bitmaps (getting them by reference through constructor), and have method "start()" that gets arguments, creates a timeline with proper tweens and returns that timeline - after that the CVectorAnimator adds that timeline to its mainTimeline. Essentially I can just call from the main class a set of effects and they start one after each other. Pretty basic. But the problem begins when I try to have a possibility to start one effect in mid-air of other effect (with using actual bitmaps positions), and it involves a tween collision. I found (by tries and errors) that timeline_.nextNode.restart(); allow me to accomplish that - it basically stops one timeline with all tweens and starts next (by experience). I didn't know that it's only for internal use . However when I'm doing it, results are not accurate. It will be the best if I will show that: http://kolibrary.webd.pl/flash/snake/ in the result, the squares should be at the same distances to each other, and in line. They aren't. But they will be if I will start that effect as first. I hope now everything is clear .
  7. Hello! I have a question . I'm making a class what job is to apply more complex tweening effects on vector of BitmapAssets (like bouncing snake etc). I want to be able to switch to second effect in mid of the first effect etc, so I achieved this by using timelines and optional arguments (I have one main timeline, and smaller timelines of specific effects and tweens). Now, the problem is that if I'm interrupting few tweens, switching them to others, accuracy is lower and lower (when i'm tweening relative values), and even if theoretically after last effect, the snake of bitmaps should land od the same y position - it doesn't. Can it be avoided? Maybe I'm not using these classes properly. I'm starting new effect by calling: private function nextTimeline(timeline_:TimelineMax) : void { if(timeline_.nextNode && !timeline_.nextNode.initted) timeline_.nextNode.restart(); } If it's not possible to secure accuracy I will try to correct things on the fly, but it won't be easy and will hit performance as it would propably involve some onUpdate listeners, logging theoretical final positions, and a lot of new tweens. Regards!
  8. Thank you very much, I was looking just for that .
  9. I'm not sure if this question is more related to greensock or to action script 3 in general, but it is related to working with greensock libraries so I think somebody may gain something from it if I ask it here. Is it possible to give as an argument not only how to tween, but also what to tween? To show what I mean by using pseudocode: var name = x; var value = 100; var pair = name:value; TweenMax.to(object, 1, { pair }); Is something like that somehow possible? Regards!