Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

macguffin

BusinessGreen
  • Posts

    42
  • Joined

  • Last visited

Everything posted by macguffin

  1. Hi Jonathan thanks for the reply. I don't think I explained myself very well http://codepen.io/anon/pen/OWdYmg?editors=1111 If you open the console you can see that the update time is 0.03 or something similar, this is the time between each update. I'm using GASP to power a particle effect but I need to know how long between updates the "update_time" As you can see I can work it out like this but wondered if this calculation was already been done in the timeline and I could just hook into that.
  2. Hi trying to integrate a particle emitter into some stuff powered by GASP. I basically need the time since the last update as the emitter requires the elapsed number of seconds since the last update. var pe_tl = new TimelineMax(); console.log('foo2', pe_tl) pe_tl.eventCallback("onUpdate", () => { console.log('update emitter') }); I have found things like _totalDuration, _totalTime and I could work it out from these but wondered if there a var in the timeline that already stores/calculates this? Thanks
  3. Hi @OSUblake sorry I never saw your reply. I have got some stuff I can show if you're interested I basically convert simple spine2D animations into GASP animation. The workflow is PSD->Spine2D powered by GSAP rendered by PixiJS. Simple layout and simple animations can be converted directly from Spine to GASP. Complex character animations are handled by thePixiSpine plugin. I can't show here but if you, Jack or anyone at Greensocks is interested I can set something up for you to see.
  4. Thanks for the reply Jack. I thought you would ensure that calls fired. I suspect it's something my end.
  5. Hi can anyone answers the following: I'm basically converting Spine2D animation into HTML5 using PixiJS to render and TweenMax (of course) to drive all the animation. It's actually working very well but I have a question about the 'accuracy' and reliability of labels. Spine2D allows you to place 'events' on it's timeline. I covert theSpine2D timeline to a TImelineMax and fire the event as below. myTimeLine.call(()=> { console.log(':: DO SOMTHING'); }, [], this, _event_data.time) If the _event_data.time which is a value generated via Spine2D is something like 6.3333 will it always fire? I am having some incidents on old devices, crappy computers where it looks like the call event is missed. So my basic question is If TimelineMax skips a frame or stalls on a slow device will the call() always fire or can it be missed? Are some rounded times more reliable? Thanks a lot all in advance. Matt
  6. Of course so simple when you know how That will work just fine for what I need, I knew there would be a way around it as you guys seems to have thought of most things. Thanks very much for such a speedy response.
  7. Great topic title I know, sorry about that. Hi I'm trying to build a TimelineMax animation dynamically by adding TweenLites which is working fine. As part of the code I need a function to be called when each of the TweenLite animations start. I'm doing this by calling onStart:. Again this works fine. I am repeating the timeline as I want to play it backwards which again is visually working as expected. I don't however seem to be able to get the onStart function to call when the TimelineMax animation is in reverse. In case this description makes no sense I have a codepen demo, you can see that the count is only increasing whilst the animation is playing forwards. I've also tried TimelineMax.reverse but this also only calles the onStart when going forwards. I'm sure there is an easy way to achieve this can anyone point me in the right direction. Cheers
  8. Thanks very much Jonathan that was just what I needed: The code that worked with an {self} as a param was this: function collisionDetect( t) { console.log('matrix x pos =', t.target._gsTransform.x) }
  9. Hi I was wondering if I could get x and y values of a transform matrix from the tween. Basically I have a small canvas stage that I'm moving rather than a small sprite on a large stage to maximise performance. var S_die = document.getElementById("IWGdie0"); TweenMax.to(S_die, 4, {x: 10, y: 10, onUpdate: collisionDetect, onUpdateParams: ["{self}"], ease: Strong.easeOut}); In the collisionDetect function I was hoping to pull the x and y values directly from the tween ("{self}"). function collisionDetect(t) { var s_x = t.vars.css.x, s_y = t.vars.css.y, console.log('matrix=', t) } I thought I found it with tween.vars.css.x but this seems to be set at the end value throughout the whole tween. (Edit: Obviously vars is what I'm defining in the tween, duh, which is why it's the same.) Is this possible as I think it would be easier in the long run than extracting the stuff from the matrix directly as I'm guessing your functions do a lot of work with compatibility. As always thanks for your help. Matt
  10. Hi I need to give my loaders created from parsing an array a specific ID based on the file name. I have done it but wanted to check that there wasn't a simpler (built in) way of doing it, as even though it works it seems a little long winded. So I create a LoaderMax with an onChildOpenHandler: var subLoadqueue : LoaderMax = LoaderMax.parse(anArrayOfURLS, {onChildOpen:childOpenHandler}); The handler gets the file location and then extracts just the file name using makeLoaderID(event) returns this name and sets it as the event.target.name. private function childOpenHandler(event : LoaderEvent) : void { if (event.target.name.toLocaleLowerCase().indexOf('loader') != -1) { //this stops the renaming of any non automatically named loaders event.target.name = makeLoaderID(event); } var $tempArray : Array = String(event.target).split(' '); IWGstore.loaderContent.push($tempArray); } private function makeLoaderID(event : LoaderEvent) : String { var $tempArray : Array = String(event.target).split(' '); var loaderID : String = 'empty'; if ($tempArray[2] != null) { var path : Array = $tempArray[2].split('/'); loaderID = path[path.length - 1].substr(0, loaderID.lastIndexOf('.')); } return loaderID; } So -FILELOCATION: (file:///e|/%7e%7ework/%7ecamelot/%7egames/newgames/asset_MC1.swf) gives me loaderContent-ID: asset_MC1 which I can then use to retrieve content in the usual way (LoaderMax.getLoader('asset_MC1').rawContent) Cheers
  11. Thanks Carl also discovered the skipFailed feature. Cheers
  12. Hi I'm sure this is simple but can you listen for an onError or onFail event from a loader created via xml. example My xml has this: if this file is missing my flash output window states: Error on SWFLoader 'MGGO' (monopolygoldtwtw_MG_GO1.swf): Error #2032: Stream Error.etc etc as expected. I want my loader to be able to listen for any error created via this XML load method. Is there a catch all for loaderMax errors? Cheers Matt
  13. Thanks Rob I knew there would be an event in there that did this. Thanks for taking the time to let me know. Cheers
  14. I'm sure I'm missing something very obvious but can an appended XMLLoader detect any XML format errors? If my XML is well formed LoaderMax.getContent("XML") shows the XML. If I deliberately spoil my XML (leave off an end tag for example) LoaderMax.getContent("XML")=null. Also once the XML is corrupted the onComplete and onError which are attached to the XMLLoader aren't fired. I thought I might be able to get round it with an onRawLoad or onIOError event but these are also not fired. Is your XMLLoader detecting that the XML is corrupt and ignoring it? If this is the case can this 'ignoring' be listened for? Part of my loader needs to check that the XML is well formed and report any errors if it isn't. I wondered if there was a way to get an error if the XML is bad, end tags missing etc. my loader queue code: loadQueue = new LoaderMax({name:"mainLoad", onChildOpen:childOpenHandler, onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler}); loadQueue.append(new SelfLoader(this, {name:"self"})); loadQueue.append(new XMLLoader(loadFile, {name:"XML",onComplete:completeXMLHandler, onError:errorXMLHandler})); loadQueue.load(); Cheers Matt
  15. Yes that's exactly what I was thinking of. I'll let you know how I get on with it and many thanks, Cheers
  16. Hi Jack, Whilst I totally agree that your approach is the right one and 'best practice' I would like to see the addition of a SELFLoader.as class. Could this be an optional activation so that it doesn't add additional weight and leaves the default as the preferred 'best practice' external loaded? I often find that restrictions placed on me by legacy infrastructures and clients demands mean that I have to adopt the less efficent 'single SWF preloading' approach. This is particulary the case with my main client who I make games for, as whilst they allow the loading of external assets the actual main part of the game need to be 'self sufficient'. Your loader class is great for getting these external assets in as I can be confident that when the queue has completed the asset will be there, that the xml will not have errors etc. I guess it if farly simple to incorporate your loader and a bog standard one along these lines: addEventListener(Event.ENTER_FRAME, mainLoadTracker); private function mainLoadTracker(event:Event):void { MAINSWFLoadPercent = (((loaderInfo.bytesLoaded / loaderInfo.bytesTotal) + JACKSPercentage) / 2) * 100 if (MAINSWFLoadPercent == 100 && isAssetsLoaded == true) { //game and all assets totally loaded } } In the above code I am getting an acurate % load of the mainSWF as JACKSPercentage is updated by your onProgress:progressHandler. I also get the additional safty check that the assets are loaded as isAssetsLoaded is only set to true when loaderMax completeHandler is fired by your class. However is doesn't seem to be as neat as it could be. One suggestion would be to add a switch to a particular LoaderMax queue somewhere along the lines of SELFLoad=true. If this if detected the loader class would add its self to that queue much in the same way I have done manually. or var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler}); queue.append(new SELFLoad()); and have the weight of the mainSwf added to the queue. I understand that both these approaches might cause problems and that my initial solution may actually be the simplest but I thought I'd see what your thoughts were. Cheers Matt
×