Jump to content
Search Community

Polarathene

Members
  • Posts

    18
  • Joined

  • Last visited

Polarathene's Achievements

0

Reputation

  1. Hi, I'm developing a site that is getting results from twitter and showing one tweet at a time, it loads an iFrame of the tweet rendered by twitter via oEmbed. The tweet drops in to the center from 0 opacity to 1 then after a moment drops down out of the window fading out. The app is performing great with a few items but it seems to be chugging a little as that number grows. I know I could remove the older tweet items after they finish their tweens however the client wants to have this timeline running at a conference lasting 30 mins for each speaker, still not an issue til the request to be able to replay the 30 min timeline at a faster speed with timeScale so the speaker can view the audience reaction(it's also tweening a css gradient BG and playing sounds based on the hashtags(variety of feelings) of the active tweet being tweened). If I remove the items I'm a little concerned about playing back in this fast forward mode and being able to load the tweet iFrames again fast enough. Any ideas?
  2. Just woken up, and with a fresh mind it occurs to me the pivot was probably at the center of the graphic but the graphic might not have been aligned correctly to have it's pivot at center(basically a bunch of circles). Could be the way I exported the SVG(pulling out separate elements for different animations), or that the SVG js lib I'm using is trimming/cropping the SVG layer instead of being the dimensions expected, thus not positioned correctly in the div. I'll look into this debugging with a css circle as a replacement first to verify if I'm right. That's what I get for coding all night to the morning!
  3. Hi, have started getting familiar with JS from AS3, want to work with GSAP of course I'm animating svgtags instead of divs, I'm not sure what is the cause of the issue, I'm doing a basic tween to rotate 360 degrees with repeat at -1. It starts off ok being centered where I want it and also ends at the same location, during the spin though it shifts to the side a bit for some reason. Any ideas? I'll try get a codepen up after I've slept. Not sure if I'll be able to load the specific graphic via codepen or not.
  4. I'm not sure how I would check the loading time like I do with VideoLoader. Not too concerned, was just curious why the first load takes 10x the duration regardless of the video file, and then any other video's same one or different will load considerably faster. Would seem that it's not related to the video but something on the code end, could be specific to the runtime handling new Video() rather than anything to do with loading.
  5. I know that I shouldn't be too concerned as this is something I've noticed while testing my app in debug. When I transition to a screen that has video content I've noticed my ui elements repositioning(Feathers/Starling) and figure it's due to the workload being too much for that frame. Haven't looked at scout but know that not loading video prevented it. I could alternatively load the video when the user presses the play button instead and have any delay occur there instead, what I'm interested in though was that the load time of 0.64 is for the first time I load a video, when I try any other it becomes 0.078, this is irrespective of what video I am loading(<15mb mp4 h264). I've had a look at the api and tried various options but had no luck. Am I right to assume there is some sort of initialization for the loader? It seems to be when I tell my loadermax queue to load the first file. Is there a way that I can avoid this delay by doing something with loadermax during my app startup? Again unlikely a major issue as long as it does not scale with file size in release.
  6. Yup, so pause(0) is the way to go. Cheers for all the help Awesome product!
  7. Err not exactly. I get that. I keep trying to point out with the last few posts that I'm dealing with two seperate timelines, I'm going to paste the code again from above. var timeline_1:TimelineLite = new TimelineLite({paused:true}) var timeline_2:TimelineLite = new TimelineLite({paused:true}) buildTween(timeline_1, 0.3) //adds tweens to target objects with a stagger of 0.3 buildTween(timeline_2, 1) //adds tweens to the same target objects with a stagger of 1 //These two tweens are added for each target object to both timeline_1 and timeline_2 inside the buildTween() function: /* var staggerValue:Number = i * _stagger _timeline.add(String(i), staggerValue) .fromTo(cardArray[i], 0.5, { alpha:0 }, { alpha:1, ease:Power1.easeOut }, staggerValue) .fromTo(cardArray[i], 0.5, { scaleX:0, scaleY:0 }, { scaleX:1, scaleY:1, ease:Back.easeOut }, staggerValue) */ //After tweens have been built, I start the first one timeline_1.restart() //Time passes, say 5 seconds a button is pressed that calls the following: timeline_1.pause()//reset the timeline with timeline.pause(0) and the problem below doesn't occur, as the playhead has reversed all the tweens setting the alpha/scale values back to 0. timeline_2.pause(2.2) //timeline_2 has done it's rendering with the playhead from "0"(initial paused state) to "2.2", it is unaware that the targets have had their alpha and scale values altered but resets them when the fromTo tween starts on the timeline? So before I manipulate either of the paused timelines, no tween targets are visible, all have scale and alpha set to 0 from the fromTo tweens. When I play timeline_1, if I then pause() it without returning the playhead to 0 reverting to the original state, when I then manipulate timeline_2 such as timeline_2.pause(2.2), then the tween targets that had their alpha/scale values set to 1 from timeline_1 will not reset to their property values to 0. Only the tweens that occur from timeline_2's starting time of 0 when it was paused on creation to the newly paused time of 2.2 will be affected. So I have the present solution of "timeline_1.pause(0)" , then timeline_2 will be accurate visually with it's tween targets. Perhaps I should make an example project?(Pretty much the same as the code sample above but you'd visually see what I'm trying to describe)
  8. I do pause() the timeline, I was asking if there was a better option than pause(0). If I just pause() and then manipulate the 2nd timeline like in the example in reply #13, then the tween targets don't reset to initial values that I set in my fromTo tweens. Is there a way to reset the tween targets to what they should be on the timeline I'm manipulating? Or is pause(0) on the previous timeline the best way to go about it like mentioned in the example in reply #13?
  9. If the starling movieclip class converts the number to int when the tween sends the value then what difference would roundProps offer? The immediateRender:true was required, tried it out with the latest GSAP release I had which had the invalidate()/fromTo bug, but with the pre-release 12.04 you provided immediateRender:true is no longer needed. So with the two timelines with the same tween targets being tweened, is it best to pause(0) the timeline I'm not going to actively be working with when I switch to using the other timeline? (example above in reply #13, timeline_1 & timeline_2) Or is there a better way to handle different sequences on the same targets?
  10. I think with my example I should have stayed with the names timeline_main, timeline_extra instead of 1/2. I had the tweens and the targets on two timelines, just with different staggered values. That's why I had a problem with rendering. I don't recall the fromTo causing an immediateRender:true without declaring it, it might have been part of the bug? I'll give it a go shortly. The movieclip having its frame property tweened looks like this: TweenMax.to(movieclipObj,1,{currentFrame:movieclipObj.numFrames,ease:Linear.easeNone,repeat:-1}) And testing it doesn't produce the error that I had mentioned, I think I was using a timeline initially like I described earlier, will try to see if I can get the old behaviour back. This one traces the currentFrame property being set with the same value about 6 times, the animation is only 8 frames, is there a way to only have the tween update the property when the currentFrame increments? I'm guessing it's sending a number to the setter which converts the value to int. Cheers.
  11. Ha, ok well I think your explanation clears it up. Below is roughly what I was doing with my code, from what I gather about the rendering, in this case I need to reset timeline_1 with pause(0) rather than just pause(). var timeline_1:TimelineLite = new TimelineLite({paused:true}) var timeline_2:TimelineLite = new TimelineLite({paused:true}) buildTween(timeline_1, 0.3) //adds tweens to target objects with a stagger of 0.3 buildTween(timeline_2, 1) //adds tweens to the same target objects with a stagger of 1 //These two tweens are added for each target object to the timelines sent to the buildTween function: /* var staggerValue:Number = i * _stagger _timeline.add(String(i), staggerValue) .fromTo(cardArray[i], 0.5, { alpha:0 }, { alpha:1, immediateRender:true, ease:Power1.easeOut }, staggerValue) .fromTo(cardArray[i], 0.5, { scaleX:0, scaleY:0 }, { scaleX:1, scaleY:1, immediateRender:true, ease:Back.easeOut }, staggerValue) */ //After tweens have been built, I start the first one timeline_1.restart() //Time passes, say 5 seconds a button is pressed that calls the following: timeline_1.pause()//reset the timeline with timeline.pause(0) and the problem below doesn't occur, as the playhead has reversed all the tweens setting the alpha/scale values back to 0. timeline_2.pause(2.2) //timeline_2 has done it's rendering with the playhead from "0"(initial paused state) to "2.2", it is unaware that the targets have had their alpha and scale values altered but resets them when the fromTo tween starts on the timeline? In another case I used a tween to control a starling movieclip currentFrame property instead of controlling it with starlings juggler. I had it trace the frame number it was changing and noticed when the tween reached the end as it would go back to the first frame the traced numbers went backwards eg("frame1","frame2","frame3","frame2","frame1"). Now that I know how the rendering works I understand why that is happening. Would be great if I could avoid that behaviour for that case though so it was telling the movieclip class to update the frame as the playhead moved back to 0 decreasing the currentFrame property. Is there some sort of book/resource out there to learn about all this? I guess that's what the forums are for
  12. Yeah I cleared it up earlier with you that it was due to me not clearing the timelines as they were paused. The 500 loop is not a part of my actual code, it was just to see the memory increase even though I'm sure I was disposing of everything for gc correctly minus the solution commented in the code that you gave me earlier. So the invalidate thing was a bug, well that's good to know Cheers for the preview. One last thing, if I have the following setup: timeline_main(has same tweens/targets, stagger 0.3) timeline_extra(has same tweens/targets, stagger 1) Then timeline_main.restart(), the tweens play through the sequence, if after that I call: timeline_main.pause();timeline_extra.pause("2") I notice that for timeline_extra's timeline all it's tweens up to that label are updated to what they should look like at that point in time. The tweens that would play after that point in time though have not reset their targets alpha/scale to 0, so...before "2" all tweens are executed/paused at that point in time, but any after that which have not started are not run at all? Can you explain this? If I set timeline_main.pause(0) instead, then all tweens are reset to the starting alpha/scale in the fromTo. Does the timeline_main have more influence? Or is it to do with the timing of the tweens from different stagger values. Is there a way to control the rendering of these timelines? Such as just rendering what tweens are active/placed at a specific time on the timeline, instead of going through and rendering/executing the previous tweens. Likewise can I reset the tween targets to the state they all started in where immediateRender:true set the scale and alpha values to 0, if I set the timeline_main to 0 the initial alpha/scale are set to what the from values in the tweens were, but not when I set timeline_extra to 0. If that's also troubling to take in I can create another example project demonstrating the issue and current solution. I might be using timelines wrong or it may be part of the bug that was fixed in your upcoming release which I haven't tried yet. Cheers for all the help, hugely appreciated. EDIT: I can confirm that it's not related to the fixed bug, most likely I am doing something wrong. If I play timeline_extra from 0 it will not update the tween targets to alpha/scale 0 until it reaches that point in time unlike timeline_main(both setup the same way via buildTween() function).
  13. Ok have put together a sample file that demonstrates the issues we've talked about. It's the full project folder for flashdevelop though perhaps all you need is the src folder. Startup is the document class. http://www.filedropper.com/greensockexample So the original problem was just caused by timeline = new timelinemax({paused:true}) where the previous was still paused and had no variable name referencing it but held references to the tween targets as you mentioned earlier. So that is sorted by using clear() instead of creating a new timeline instance. There is an example of the visual error I experience if I don't use invalidate() and another of memory increase when I repeatedly add the same tween/tween target. Code has plenty of comments, if you could explain the issue I have if I don't invalidate() that'd be great. I'm pretty sure it has something to do with having two timelines, where one has the tween targets active and the other has the same tween targets but paused.
  14. Just in case you're wondering why I set tweenLiteInstance to the timeline animation call, from what I understand the fromTo creates a tweenLite instance and I was experiencing a problem where I was getting unintended animation on my sprite graphics while another timeline was running, storing the instance and killing it fixed the issue.
  15. I guess I misunderstood invalidate(), I've removed it but noticed I'm getting an issue if I interrupt the timeline. First I'll bring up again that I'm not doing a for loop on a function 5,000 times design wise, I have a newGame() function that resets variables to starting values and builds the tweens on the timeline. To check that I had no memory issues I added the for loop and ran the function 5,000 times to avoid clicking a button that triggers newGame() manually. If I comment out the invalidate() line, when I run my code I see the animation play perfectly fine, if I press the button that runs newGame() while a tween is running on the timeline, when the timeline is cleared and the new tweens added for the next set of cards to animate that specific point in time where the previous tween was interrupted, the new tween in it's place does not seem to appear, but every other tween in the sequence worked fine. I tried this with different parts of the sequence and it was always missing the tween where I interrupted previously. Perhaps the alpha or scale value for that tween was at 0 and didn't tween to 1 when newGame() cleared the timeline and added a set of new tweens for the new sprite graphics. So I'm not sure what invalidate() does in this case that avoids that visual error, but it works and if that avoids any visual error I'm all for it. The newGame() function clears both timelines(autoTimeLine with a stagger of 0.3 and controlledTimeLine with a stagger of 1), it also performs removeChildren(0,-1,true) on the container sprite for my card graphics, in starling this is meant to perform dispose on the graphics which should free them up for gc, I also null the array and create a new one with "cardArray=[]" that stores the graphics that buildTween() uses to provide tween targets. There is a TweenMax.killAll() in there as well, though since I am no longer using tweenMax perhaps that is now useless. I've just added to newGame() after the timeline.clear() timeline = new timelineMax({paused:true}). This also fixes the issue like invalidate() was doing. Perhaps you can provide some more insight, still more than happy to put together an isolated example and if it reproduces the problem send it off to you. I know that I previously encountered an issue with restart() on a tween if it had a delay where the tween only moved back a few frames/moment in time rather than restarting completely. I tested it on a non-starling project and didn't encounter the error so it's possible any other issues I'm experiencing could be due to my use of starling/feathers/stage3D? As for the first issue we were discussing, it definitely seems like the starling sprites were the cause of the bulk of memory and weren't able to be gc'd due to the orphaned paused timelines that still had tweens targeting them. I just found it odd that if I copy/pasted the same line that created a tween with the same target, that the size continued to go up, as if it was adding a copy of the sprite or something else was going on that was increasing the memory. 5,000 iteration loop aside, I'll move the variables that are only used by my buildTween function into the function. I'm still pretty new to how to optimize code. Is there a better solution to restarting individual tweens than using a dictionary? Each newGame() will create 4-6 card graphics to be tweened based on the top 6 card values of a deck. At the moment I'm using: tweenLiteInstance = controlledTimeline.seek(drawCount).tweenFromTo(controlledTimeline.time(), controlledTimeline.getLabelAfter()) drawCount++ The sequence will always be drawn in the order it was built, for that timeline the tweens are 0.5 and have been staggered by 1 second, the label is just a string of the iteration in the buildTween() loop as provided above. Though using that code on the autoTimeLine with the stagger of 0.3 would cause other tweens to popup as they overlap and if taking manual input should only display one at a time. Using a dictionary I could just use: tweenDictionary[String(drawCount)].restart() drawCount++ The only problem I have with that is that each card graphic has two tweens as my alpha and scale have different eases(wanting alpha to be 1 before the bounce of the back ease on scale happens). Sorry about the huge amount of text, I really appreciate your support and hope to purchase a greensock license later in the year. If you need an example for any of the discussed issues, I work solely in FlashDevelop so I have no .fla file, I could provide a .zip of a project folder instead?
×
×
  • Create New...