Jump to content
Search Community

Fading screensaver - looping

slayaz test
Moderator Tag

Recommended Posts

I have just tried to create my first job using greensock, and I am impressed!

 

I need to get this finished urgently and need some help.

 

The job is a simple tweening job that will become a screensaver, i have managed to make everything fade beautifully, but i'm sure there is a better way to do it.

 

The main problem I have is making it loop. It needs to loop continuously.

 

the code is below and i would really appreciate some help.

 

Many thanks!

 

import com.greensock.*;

TweenMax.allTo([imageone, imagetwo, imagethree, imagefour,imagefive, textone, texttwo, link, lookingforward], 0, {_alpha:0});

TweenMax.to(imageone, 2, {_alpha:100, delay:1});
TweenMax.to(imageone, 2, {_alpha:0, delay:5});

TweenMax.to(imagetwo, 2, {_alpha:100, delay:6});
TweenMax.to(lookingforward, 2, {_alpha:100, delay:7});
TweenMax.to(imagetwo, 2, {_alpha:0, delay:10});

TweenMax.allTo([imagethree, textone], 2, {_alpha:100, delay:11});
TweenMax.allTo([imagethree, textone], 2, {_alpha:0, delay:15});

TweenMax.allTo([imagefour, texttwo], 2, {_alpha:100, delay:16});
TweenMax.to(imagefour, 2, {_alpha:0, delay:20});

TweenMax.to(imagefive, 2, {_alpha:100, delay:21});

TweenMax.to(link, 2, {_alpha:100, delay:23});

TweenMax.allTo([imagefive, link], 2, {_alpha:100, delay:27});
TweenMax.allTo([imagefive, link, texttwo], 2, {_alpha:0, delay:31});

Link to comment
Share on other sites

Ok, first of all I apologise.

 

For being a noob and not reading every thing I can on the subject but I was under time constraints and I got a bit stressed and desperately wanted to make this work.

 

I have since done some research and read plenty and I realise I need to use Timelinelite but I can't find an example that covers what I am trying to do. I am very new to this and all the examples seem more complicated than I need.

 

I would love to learn how to do this but I am being shouted at by my line manager to get it sorted, so I would really appreciate some help.

Many, many thanks.

 

Legs

Link to comment
Share on other sites

Hi slayaz

 

The most elegant way to solve this would be using TimelineMax. But you could also place an onComplete function at the end of your last tween. You just need to put the whole thing into a function:

 

import com.greensock.*;

startLoop()

function startLoop():Void
{
TweenMax.allTo([imageone, imagetwo, imagethree, imagefour,imagefive, textone, texttwo, link, lookingforward], 0, {_alpha:0});

TweenMax.to(imageone, 2, {_alpha:100, delay:1});
TweenMax.to(imageone, 2, {_alpha:0, delay:5});

TweenMax.to(imagetwo, 2, {_alpha:100, delay:6});
TweenMax.to(lookingforward, 2, {_alpha:100, delay:7});
TweenMax.to(imagetwo, 2, {_alpha:0, delay:10});

TweenMax.allTo([imagethree, textone], 2, {_alpha:100, delay:11});
TweenMax.allTo([imagethree, textone], 2, {_alpha:0, delay:15});

TweenMax.allTo([imagefour, texttwo], 2, {_alpha:100, delay:16});
TweenMax.to(imagefour, 2, {_alpha:0, delay:20});

TweenMax.to(imagefive, 2, {_alpha:100, delay:21});

TweenMax.to(link, 2, {_alpha:100, delay:23});

TweenMax.allTo([imagefive, link], 2, {_alpha:100, delay:27});

// The last tween calls it again and again
TweenMax.allTo([imagefive, link, texttwo], 2, {_alpha:0, delay:31, onComplete:startLoop});

}

 

I hope it works

Link to comment
Share on other sites

G'day mate,

 

Dunno if this will help you, but heres some sample code from a banner I made with TimelineMax + Tweenlite. It's an infinite looping banner too. You basically just keep appending your tweens to a TimelineMax/lite object and remember in the init vars to set repeat value to -1 which will make it loop forever. The banner is made in AS2 but you should be able to see how the Greensock code works regardless.

 

Cheers

 

-Z

 

import com.greensock.TimelineMax;
import com.greensock.TweenAlign;
import com.greensock.TweenLite;
/**
* ...
* @author Zync
*/
class ddBanner extends MovieClip
{
public var DarwinDeez:MovieClip;
public var packshot1:MovieClip;

public var specialEdition:MovieClip;
public var bonusTracks:MovieClip;
public var podLogo:MovieClip;
public var xLogo:MovieClip;
public var packshot2:MovieClip;

public var clickHere:MovieClip;

//public var darwinTouring:MovieClip;
//public var withParklife:MovieClip;

public var enterComp:MovieClip;
public var directPhotoshoot:MovieClip;

private var tl:TimelineMax;

public function ddBanner() 
{

	tl = new TimelineMax( { repeat: -1, repeatDelay:1 } );
	tl.timeScale = 0.6;

	tl.append(TweenLite.from(DarwinDeez, 0.5, { _x:"-400" } ));
	tl.append(TweenLite.from(packshot1, 0.5, { _x:450 } ));
	tl.appendMultiple([
	TweenLite.to(DarwinDeez, 0.3, { _y:"150" } ),
	TweenLite.to(packshot1, 0.3, { _y:"-150" } )
	], 2, TweenAlign.NORMAL, 0);

	tl.append(TweenLite.from(specialEdition, 0.3, { _y:"-150" } ));
	tl.append(TweenLite.from(bonusTracks, 0.3, { _y:"150" } ));
	tl.append(TweenLite.from(podLogo, 0.3, { _x:450 } ));
	tl.append(TweenLite.from(xLogo, 0.3, { _x:450 } ));
	tl.append(TweenLite.from(packshot2, 0.3, { _x:450 } ));
	tl.appendMultiple([
	TweenLite.to(specialEdition, 0.3, { _y:"150" } ),
	TweenLite.to(bonusTracks, 0.3, { _y:"-150" } ),
	TweenLite.to(podLogo, 0.3, { _y:"-150" } ),
	TweenLite.to(xLogo, 0.3, { _y:"150" } )
	], 2, TweenAlign.NORMAL, 0);

	tl.append(TweenLite.from(clickHere, 0.3, { _y:"-150" } ));
	tl.appendMultiple([
	TweenLite.to(clickHere, 0.3, { _y:"150" } ),
	TweenLite.to(packshot2, 0.3, { _y:"-150" } )
	], 2, TweenAlign.NORMAL, 0);

/*		tl.append(TweenLite.from(darwinTouring, 0.3, { _y:"-150" } ));
	tl.append(TweenLite.from(withParklife, 0.3, { _y:"150" } ));
	tl.appendMultiple([
	TweenLite.to(darwinTouring, 0.3, { _y:"150" } ),
	TweenLite.to(withParklife, 0.3, { _y:"-150" } ),
	TweenLite.to(packshot2, 0.3, { _y:"-150" } )
	], 2, TweenAlign.NORMAL, 0);*/


	tl.append(TweenLite.from(enterComp, 0.3, { _y:"-150" } ));
	tl.append(TweenLite.from(directPhotoshoot, 0.3, { _y:"150" } ));
	tl.appendMultiple([
	TweenLite.to(enterComp, 0.3, { _y:"150" } ),
	TweenLite.to(directPhotoshoot, 0.3, { _y:"-150" } )
	], 2, TweenAlign.NORMAL, 0);


}


}

Link to comment
Share on other sites

Wow, thanks sooo much, Anitainment, that is such a simple solution and absolutely perfect for what I need.

 

Zync, that looks like a serious bit of code and I am eating my breakfast, and going through it to try and understand it bit by bit.

 

Thanks again for your help.

 

:D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...