View Full Version : Make a circle getting bigger
tast
August 13th, 2003, 04:57 PM
Hope that anyone can helt me make a little action script,-
that take a "movie" and scale it from zero to 100%
Just like if u would do it with a "Motion Tween".
andr.in
August 13th, 2003, 05:09 PM
onClipEvent(enterFrame) {
if(_alpha < 100) { //wrong code
_alpha++; //wrong code
} //wrong code
} //wrong code
Add these actions to the movieclip (circle)!
make sure you set the alpha 0 too!
jsk
August 13th, 2003, 05:14 PM
don't you mean _xScale and _yScale, Syko?
tast
August 13th, 2003, 05:30 PM
Iīve found this code, andi works well,-
But how do i make it stop at a serten point.
Letīs say it has scailed the picture 150,- then i want it to stop.
onClipEvent (load)
{
z=0;
zspeed=5;
fl=10;
}
onClipEvent(enterFrame)
{
scale=fl/(fl+z);
_xscale=_yscale=150*scale;
z-=zspeed;
}
jsk
August 13th, 2003, 05:49 PM
onClipEvent(enterFrame)
{
if (_xscale<=150) {
scale=fl/(fl+z);
_xscale=_yscale=150*scale;
z-=zspeed;
}
}
andr.in
August 14th, 2003, 01:16 AM
lol jsk! I must be going nuts! Yes I meant Xscale and Yscale!
lol!
No more coffee to me!
comicGeek
August 14th, 2003, 02:32 AM
You can use the easing equation inscalling. That way the scalling is smoother:
Make sure that the movie clip you want to scale has a smaller scale percentage than myXscale and myYscale.
onClipEvent(load){
//change these values to the amount in scalling percentage.
myXscale = 100;
myYscale = 100;
}
onClipEvent(enterFrame){
_xscale += (myXscale - _xscale)/3;
_yscale += (myYscale - _yscale)/3;
}
pom
August 14th, 2003, 08:51 AM
And there's no need to calculate the focal length unless you want to do some more advanced perspective effects :)
onClipEvent(enterFrame)
{
if (_xscale<=150) {
_xscale=_yscale += 5 ;
}
}
comicGeek
August 15th, 2003, 12:26 AM
Oh and that too! :P
I thought there's something wrong with my script.... whew!
:)
Scootman
August 15th, 2003, 03:00 AM
onClipEvent(enterFrame)
{
if (_xscale<=150) {
scale=fl/(fl+z);
_xscale=_yscale=150*scale;
z-=zspeed;
}
}
what exactly does this code that jsk posted do? does it ease up to 150? or am i wrong
radicaljugnu
August 15th, 2003, 04:01 AM
onClipEvent(enterFrame){
(_xscale<100)?(_xscale+=3;_yscale+=3): (_xscale=_yscale=100)
}
radicaljugnu
August 15th, 2003, 04:02 AM
same thing
tast
August 15th, 2003, 01:31 PM
Iīm all new to this Action script,-
and after getting all the results of this question, iīve tryed to play around with this:
onClipEvent(enterFrame)
{
if (_xscale<=150) {
_xscale=_yscale += 5 ;
}
}
and changed it to this:
onClipEvent(enterFrame)
{
if (_alpha<=100) {
_alpha -= 5 ;
}
}
It make a picture fade out,-
HOW do i make it fade out and then fade in????
No matter what i do i canīt make come back!!!!!
wilma
August 18th, 2003, 08:25 AM
try this
onClipEvent (load)
{
_alpha = 4;
reached100=false
}
onClipEvent (enterFrame)
{
if ((_alpha<100) and (reached100==false)){
_alpha+=2;
}
else {
if(_alpha!=0){
reached100=true
_alpha-=2;
}
}
}
Eric Jr.
August 18th, 2003, 08:37 AM
If we'd just want to fade out and in, I'd do it like this:
MovieClip.prototype.fade_out_in = function()
{
this._alpha = 100;
direction = -1;
this.onEnterFrame = function()
{
if (this._alpha > 100 || this._alpha < 0)
{
if (direction == -1)
{
// At this point the photo is invisible
// So if you'd want you could change it ;P
direction = 1;
}
else delete this.onEnterFrame;
}
this._alpha += (2*direction);
}
}
photo_mc.fade_out_in();
pom
August 19th, 2003, 07:13 AM
Originally posted by jugnu
onClipEvent(enterFrame){
(_xscale<100)?(_xscale+=3;_yscale+=3): (_xscale=_yscale=100)
} Let's be serious...
And there are a few more methods here: http://www.kirupaforum.com/forums/showthread.php?s=&threadid=4016
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.