Skip to content

Instantly share code, notes, and snippets.

@asanocorp
Last active August 29, 2015 14:06
Show Gist options
  • Save asanocorp/850c392552855b202743 to your computer and use it in GitHub Desktop.
Save asanocorp/850c392552855b202743 to your computer and use it in GitHub Desktop.
looping gwd comp
https://groups.google.com/d/msg/gwdbeta/WFi3b12fKLU/TB-8hDqnEvcJ
----------
Hi GWD team
Have you figured out yet how to add simple loop timeline animation control. Ive read a few hack options but i was wondering if there is something stable and easy to use.
Im building MPU deployed to Doubleclick studio for a client and it's a requirement for the banner to loop twice. Any help would be much appreciated.
thanks
Nathaniel Hulley
----------
Hi Nathaniel,
Luke's instruction (for Timeline Advanced mode) would work if you only have one element that is animated or multiple elements that animate at the same duration and you need to set the loop for each layer in the timeline. If you have multiple elements playing at different duration, there's another way that you loop the animation for the entire ad by setting the timeline gotoAndPlay event, and adding a couple lines of code to set the counter to stop this gotoAndPlay.
In your file, switch to Timeline Advanced mode, add a timeline label called start at frame 1. At the last keyframe of your animation, add a timeline event, select gotoAndPlay under Timeline for Action, select your page ID for receiver, and start for label.
Preview, at this point, your ad should loop forever.
Switch to code view, find the JavaScript function gwd.auto_Page1Event_1 = function(event)
you can add the var counter outside of the function, and edit the function to set it to gotoAndPlay only if counter is less than 1, like this:
var counter = 0;
gwd.auto_Page1Event_1 = function(event) {
// GWD Predefined Function
if (counter < 1) {
gwd.actions.timeline.gotoAndPlay('page1', 'start');
counter++;
}
};
I attached the author file so you can take a look at it.
Hope it helps.
San
https://drive.google.com/file/d/0Bzr6niK2v1pvT2R4Sk9vT3B5SXM/edit?usp=sharing
> By [@asano_corp](https://github.com/asanocorp) with [StackEdit](https://stackedit.io/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment