Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Elasticity Script


I have used the following script on a movieclip;
onClipEvent (load) {
k = 0.8;
damp = 0.7;
orgzx = _width;
orgzy = _height;
zx = _width;
zy = _height;
lower = _x-(_width*0.5);
higher = _x+(_width*0.5);
bottom = _y+(_height*0.5);
top = _y-(_height*0.5);
scale = 3;
vx = 0;
vy = 0;
}
onClipEvent (enterFrame) {
inside = (_root._xmouse>=lower) && (_root._xmouse<=higher);
outside = (_root._xmouse<lower) || (_root._xmouse>higher);
func = (_root._ymouse<top) || (_root._ymouse>bottom);
if (inside) {
zx = orgzx*scale;
zy = orgzy*scale;
}
if (outside) {
zx = orgzx;
zy = orgzy;
}
if (func) {
zx = orgzx;
zy = orgzy;
}
ax = (zx-_width)*k;
vx += ax;
vx *= damp;
_width += vx;
ay = (zy-_height)*k;
vy += ay;
vy *= damp;
_height += vy;
}

Does anyone know how you change it so that it dosen't bounce so much?
Thanks




FlashKit > Flash Help > Flash ActionScript
Posted on: 10-23-2005, 12:05 PM


View Complete Forum Thread with Replies

Sponsored Links:

Elasticity
I want to create an elasticity effect. When the user presses a button I want my images to slide in and bounce slightly rather than stop abruptly. I don't know a whole lot about action code required for this. Could someone walk me through this?

View Replies !    View Related
Elasticity
Is there a tutorial on how to make bouncy or elasticity drop down menu ?

View Replies !    View Related
Elasticity
I need that object enters the scene elasticly.
Can somebody write me code for It.
Thanks

View Replies !    View Related
Elasticity
i got this movie
http://www.flashkit.com/movies/Scrip...2357/index.php
it's about elasticity
well i don't understand nothing whats in there lol.
anyway i just need the concept here how can u achive that elastcity?
i'll try to figure it out my self i just need the concept

View Replies !    View Related
Elasticity
hi, (first sorry for my english)

Who can tell me, where I can find a good tutorial for "elasticity effect", that works with MX 2004. Or even better,if it's not too much trouble, why this one does not work...

in an mc

onClipEvent(load){
tx=170;
ty=80;
k=.2;
damp=.9;
}
onClipEvent(enterFrame){
if(!drag){
ax=(tx-_x)*k;
ay=(ty-_y)*k;
vx+=ax;
vy+=ay;
vx*=damp;
vy*=damp;
_x+=vx;
_y+=vy;
}
}

inside the mc this button.

on(press){
startDrag("");
drag=true;
}
on(release, releaseOutside){
stopDrag();
drag=false;
}


Thanks

View Replies !    View Related
Elasticity
Is that a word?

anyway, how do you do the animation where something is moving along and it stops but it kinda goes past its mark and then eases back in...sorta elastic? you know what I mean?

View Replies !    View Related
Elasticity Between Mc
if you go through my fla there are three movie clips. on rollover the one which is below pointer increases its size and on rollout it decreases.
so i want the other mc to adjust the space between them automatically while this increasing and decreasing is going on.

View Replies !    View Related
AAh Elasticity Please Help
i have found this easy bit of code to add elastcity to movie clips
however it works beautifully on one clip but if you aplly it more than one clip it gets confused and starts affecting the other clips without having to roll over them??
Why is this, im sure it must be an easy solution, i have tried putting the clips on different layers to each other no luck.
ANYWAY here is the code

on main timeline

movieclip.prototype.elasticScale = function(tar, accel, convert) {
xScale = xScale * accel + (tar - this._xscale) * convert;
yScale = yScale * accel + (tar - this._yscale) * convert;
this._xscale += xScale;
this._yscale += yScale;}


on theclips

onClipEvent(enterFrame){
if(this.hitTest(_root._xmouse,_root._ymouse,true)) {
this.elasticScale(150,0.9,0.5)
}else if (!this.hitTest(_root._xmouse,_root._ymouse,true)){
this.elasticScale(100,0.9,0.5)
}
}

I have already chenged the 'this' title to the instance names of the clips. Any help appreciated.

View Replies !    View Related
Elasticity Btw MCs
I've been reading tutorial after tutorial on Elasticity but I havent been able to find one that breaks down how using the size of a movieclip can change the size of other movieclips.

For instance: http://kurtnoble.com...

When clicking on one box as it grows it shrinks the previous box and pushes the the others (to the left of right) all using an elastic type effect.

Any ideas on how to do this?

Thanks

View Replies !    View Related
Elasticity
Hi,
Im using the fallowing code for a smooth movement for objects, the thing I want is I also want it to be like elastic.

MovieClip.prototype.closefolder = function(newidth, newheight, speed, loader) {
this.onEnterFrame = function() {
current_w = this._width;
current_h = this._height;
this._width -= (current_w-newidth )/speed;
this._height -= (current_h-newheight)/speed;
};

How to do that ?
thanks

View Replies !    View Related
Elasticity
How would an elasticity script look in Flash 8?
I tried the following link:
http://www.kirupa.com/developer/actionscript/spring.htm
But it doesn't work when I publish in Flasher player 7 or 8.

Can I use the tween class here? I want the animation to follow mouse movement.

View Replies !    View Related
Elasticity And X/y
This...

Movieclip.prototype.elasticMove = function(target, accel, convert) {
step = step * accel + (target - this._x) * convert;
this._x += step;
}

is the code in the actions layer


This

onClipEvent (enterFrame) {

elasticMove(_root.newX, 0.7, 0.3)

}

onClipEvent(load){
_root.newX= 303;
}


is the code on the mvie clip to relocate it on the x axis. A button would specify a new x position with this code
on(release){
_root.newX=960;
}

So I'm wondering how I can make it so this code also moves the movie clip on the y axis so i can have a diagonal move.
Any takers?

View Replies !    View Related
Elasticity Using AS
Hi all. I want to put a bit of a 'bounce' onto this bit of code I have for an expanding cirlce. You know the kind of thing I mean. I want it to 'pop' open and then settle into an open circle.

m_Spot1.onEnterFrame = function() {
if (m_Spot1._xscale<200) {
m_Spot1._xscale += 35;
m_Spot1._yscale += 35;
}
};


Any help would be appreciated.

View Replies !    View Related
Elasticity
Hi,
Im using the fallowing code for a smooth movement for objects, the thing I want is I also want it to be like elastic.

MovieClip.prototype.closefolder = function(newidth, newheight, speed, loader) {
this.onEnterFrame = function() {
current_w = this._width;
current_h = this._height;
this._width -= (current_w-newidth )/speed;
this._height -= (current_h-newheight)/speed;
};

How to do that ?
thanks

View Replies !    View Related
Need Your Help With Elasticity
Hello,
I have this little problem. I have 5 buttons sorted verticaly in a MC and when I press i.e. 3rd button I want the remaining 2 buttons to move down to a specific y value in an elastic way.

I found a code that works on MC when it loads, but I can't figure out how to tell the MC to move when I press the button.
Here's the MC bouncing code:


ActionScript Code:
onClipEvent(load) {
this._x = 100 ;
endPosx = 250;
movex = 0
}
onClipEvent(enterFrame) {
currentPosx = this._x;
diffPosx = endPosx - currentPosx;
movex = movex + diffPosx/5;
movex = movex*0.85;
this._x = this._x + movex;
}


but I don't know how to run it when I press the button.

View Replies !    View Related
How Would I Add Elasticity ?
I have this mass of script within a movieclip, at the moment it works nicely but I want to push it a step further and bring some elasticity into the movement. I cant get my head around it, can anyone help in advising how I would add elasticity to the rescaling

thanks in advance


ActionScript Code:
onClipEvent (load) {
    flapOpen = false;
    speed = 3;
    start = 100;
    end = 130;
    startpos = 52.5;
    endpos = 66.3;
    moveOpen = 0;
    alpho = 50;
}
 
 
onClipEvent (enterFrame) {
    if (moveOpen == 1) {
        remainDist = end - _parent._xscale;
        remainPos = endpos - _parent._y;
        remainAlph = start - _parent._alpha;
        _parent._xscale = _parent._xscale + (remainDist/speed);
        _parent._yscale = _parent._yscale + (remainDist/speed);
        _parent._y = _parent._y + (remainPos/speed);
        _parent._alpha = _parent._alpha + (remainAlph/speed);
        flapOpen = true;
    }
    else if (moveOpen == 2) {
        remainDist = (start - _parent._xscale);
        remainPos = startpos - _parent._y;
        remainAlph = alpho - _parent._alpha;
        _parent._xscale = _parent._xscale + (remainDist/speed);
        _parent._yscale = _parent._yscale + (remainDist/speed);
        _parent._y = _parent._y + (remainPos/speed);
        _parent._alpha = _parent._alpha + (remainAlph/speed);
        flapOpen = false;
    }
}

View Replies !    View Related
Elasticity...
its a remarcable effect. therefore i need to learn it. please, give me a code example of creating elasticity on objects. actually what kind of objects can have elasticity?

(oh and im a total n00b, so plz dont feel offended by my n00bish questions ).

View Replies !    View Related
Elasticity
Hello Everyone.
No questions that is a pretty neat work. http://www.intricate.nl
Does anybody have any idea how is the action script done for the work option menu??
I know it involves elasticity, some math...but you guys have some example or something???

Thanks,

View Replies !    View Related
|netbabyworld |+| Elasticity|
Hi,

I am trying to get my head around some physics. I have looked at several examples of elasticity and inertia but can't understand it fully.

The effect i am tring to achieve is similar to one used on NETBABYWORLD. The interface for the game slides in and out of the screen for each section. I am trying to work out how to script an MC/MCs so it leaves the screen in the same way as the above example.

The object goes backwards slightly before shooting off screen with accelaration.

Any advice/code is greatly appreciated.

Thanks in advance.

Frank.

View Replies !    View Related
Elasticity Code
Just wondering if there is a code out there that might make something move in more a elastic look. Like it bounces back and forth and settles into its final resting spot. I do not want to do it with tweening i would rather do it with code. Please let me know if this does not make any sense. Thanks

e

View Replies !    View Related
Elasticity, -a^2, +a^2, And Of Course Viscosity
Can anyone point me to a tutorial regarding the application of adding 'physical' properties to animations... like speeding up, slowing down, elasticity, and viscosity...

Most speciffically I'm looking for something to create the effect of viscosity...

Anyone ever taken Fluid Mech? Well I want an effect that would be similar to dropping the little ball in the oil... it goes in and then travels very slowly through...

Thanks in advance,

p.s I searched the word viscosity... and came up pretty much null other than minor references to it in code that didn't really carry any true explanation....

View Replies !    View Related
Elasticity Effect
Hi All,

Can any one help me, How can I make a object to move like a elastic.

I have seen this site which some sort thing that I am looking For

HERE is the Site


If any one have some tutorials regarding this pls do provide.

I want to learn the thing.


Regards

View Replies !    View Related
Simple Elasticity
Hi has anyone got an example of a really simple way to create a bounce effect in flash (with elasticity).

Any help much appreciated

Thanks

Chris

View Replies !    View Related
Lines And Elasticity
I've found some awesome tutorials on dynamic line drawing:

http://www.macromedia.com/devnet/mx/...n_drawing.html

and on elasticity:

http://www.kirupa.com/developer/actionscript/spring.htm

What I need is 2 or more MC's connected by a line. You can drag the MCs and they snap back to their spot, but the line always connects them - can't seem to figure this out.

Any help?

View Replies !    View Related
Elasticity And Physics
Can anyone help me find tutorials on how to create elastic effects with actionscript for FLASH MX 2004?

Thanks.

View Replies !    View Related
Easing With Elasticity
Hi

I was wondering if anybody could help me?

I am using :

onClipEvent (load) {
myObject = 560;
speed = 8;
_x = 150;
onEnterFrame = function() {
_x += (myObject-_x)/speed;
};
}

The movie clip slides in on the stage, but how can I add elasticity, to make it look a bit more realistic?

I hope anybody can help me or point me in the right direction.
Thanks in advance

LionZion

View Replies !    View Related
[F8] Easy Elasticity
I know somebody knows this, but when you are drawing a line from a point to the mouse (lineTo)and you want the line to snap back to the point when the user lets go of the mouse, how would you do that? I need a semi-realistic way of making the line look like an elastic band snapping back to the starting point? Got any help?

View Replies !    View Related
Easing With Elasticity
Hi

I was wondering if anybody could help me?

I am using :

onClipEvent (load) {
myObject = 560;
speed = 8;
_x = 150;
onEnterFrame = function() {
_x += (myObject-_x)/speed;
};
}

The movie clip slides in on the stage, but how can I add elasticity, to make it look a bit more realistic?

I hope anybody can help me or point me in the right direction.
Thanks in advance

LionZion

View Replies !    View Related
Ymove W/elasticity
hi everyone,

my goal is:
to have a mc "fly in" to the position x=200,y=300 for example.
but i want it to "rebounce" or be elastic (really dont know if
it is called that?) ...
i have been working with this tutorial:
http://www.kirupa.com/developer/actionscript/spring.htm

BUT: how can i change the script, so the mc is not attached
to the mouse movement, but bounces into 200,300???

any advice or hint greatfully appreciated ...
thanx

View Replies !    View Related
Elasticity In Flash
Does anyone know how to go about making things elastic in flash? eg, stretching and contracting.

View Replies !    View Related
Elasticity Function In MX
Hi does anyone know how to write an elasticity function in MX?

This works in 5 - but I want to use dynamic masking also - here's the code (slightly modified from Ilyas Usal. Ilyas is also known as ilyaslamasse )



MovieClip.prototype.move = function (centerx,centery,inertia,k) {

x = -this._x + centerx ;
y = -this._y + centery ;

xp = xp * inertia + x*k ;
yp = yp * inertia + y*k ;

_x += xp ;
_y += yp ;
}


this goes in the movieclip:


onClipEvent (load) {
newx = this._x;
newy = this._y;

}

onClipEvent (enterFrame) {

this.move (newx,newy,0.45,0.5);


}

then you can set newx and newy how ever you want buttons or timeline.

I need it to work in MX - any suggestions?


-DWC

View Replies !    View Related
Elasticity In Mx 2004
Hey guys I have been using mx 2004 for the last couple of days,
and i wanted to do the elasticity effect but it seems not to work. Heres the formula i use on flash mx...


var k:Number = .2;
var damp:Number = .9;
var tx:Number = 300;

ax += (tx-_x)*k
vx+=ax;
vx*=damp;
_x += vx;

Any ideas on how to make it work on mx 2004?

View Replies !    View Related
Boxes And Elasticity
I'm working on a new design for my portfolio site. I haven't decided if I like it yet or not. (the layout is at http://ajmoore.f2o.org if you wanna take a look and add any comments). But my question is about elasticity and boxes. What I want to do is start with a small square and have it expand to its planned size. Thats no problem, I can do that. But I've seen an effect on some sites out there (of course I can't find an example right now) where when the box expands, it kind of blows up beyond its new size and retracts back. Its not just a simple dimension change though, because the boxes sides actually expand, kind of like its about to morph into a circle but bounces back. I'm not sure how I would do that...Is there a property I can change to control the arc of the sides in action script? I'm still very new to flash so I'm sorry if this is a stupid question, but any help would certainly be appreciated.

Thanks,
AJMoore

View Replies !    View Related
Understanding Elasticity
I've been reading over and over the tuts on here by Pom, and Lostinbeta's experiment on elasticity and springy effects. I've even went through and read Penners' chapt.7 a few times. I still have know idea how I would adapt these methods to simply making a box appear out of no where, grow to a certain size, bounce past its limits, then retract. (you all know what I mean) I am not good with these equations at all, and don't know how to adapt effects like these. I know this is alot to ask around here, but if anyone can help me understand. Or even show an example of how I can make a box or shape do this on its own with a onClipEvent. As opposed to mc's following a mouse. Thanks if anyone replies.

View Replies !    View Related
Proximity Elasticity
does anyone know what proximity code to add to this elasticity fla to get the elastic effect to only respond to the proximity of the mouse intead of the root.

View Replies !    View Related
Elasticity Question
Hi there,
I'm trying to create a menu which is comprised of little cards on strings. The viewer will be able to pull down on the cards and let them bounce up and down, but they shouldn't be able to drag the entire movie clip horizontally, just vertically. How do I do this? I've attached the movie, it's working, except for them not being able to drag the clip horizontally.
OR they can drag the clip horizontally, but not off the edge of the screen. . . don't know how to do that either.
Ayudame!
Au secure!
Help!

View Replies !    View Related
Eye Curve + Elasticity
Hi. I'm trying to create an eye effect where the pupil will follow the mouse arrow and slightly curve (like a sphere) when the mouse arrow is at an angle. I am also trying to have the pupil bounce back when the mouse arrow leaves the swf. any help would be greatly appreciated.

this is what I have so far but its buggy and only worx if its as 1.0
I tried to convert to as2 from what I saw on the forum but I'm still trying to figure it out.

ActionScript Code:
onClipEvent(load){
MAXeyeMovement = 30
distanceFromEye = 5
ovality = 1.5
origin = {x:116,y:191}
centerx = 116;
centery = 191;
x0 = this._x;
y0 = this._y;
}

onClipEvent(mouseMove){
xdiff = _parent._xmouse - origin.x
ydiff = _parent._ymouse - origin.y
radius = Math.min(Math.max(Math.sqrt(xdiff*xdiff+ydiff*ydiff)/distanceFromEye,0),MAXeyeMovement)
angle = Math.atan2(ydiff,xdiff)
_x = Math.cos(angle)*radius*ovality + origin.x
_y = Math.sin(angle)*radius + origin.y
updateAfterEvent()
}

onClipEvent (enterFrame){
if (pressing) {
startDrag(this, true);
xp = this._x-x0;
yp = this._y-y0;
x0 = this._x;
y0 = this._y;
} else {
mc.buffer.stopDrag();
this.move(centerx, centery, 0.1,0.9);
}
}

View Replies !    View Related
An Item's Elasticity
Hi all,

I have a movie clip tween to the middle of the stage from the bottom. How can I get it to kinda bounce a bit before completely stopping?

Thanks!

View Replies !    View Related
Ymove W/elasticity
hi everyone,

my goal is:
to have a mc "fly in" to the position x=200,y=300 for example.
but i want it to "rebounce" or be elastic (really dont know if
it is called that?) ...
i have been working with this tutorial:
http://www.kirupa.com/developer/actionscript/spring.htm

BUT: how can i change the script, so the mc is not attached
to the mouse movement, but bounces into 200,300???

any advice or hint greatfully appreciated ...
thanx

View Replies !    View Related
Elasticity In Flash
Does anyone know how to go about making things elastic in flash? eg, stretching and contracting.

View Replies !    View Related
Elasticity Function In MX
Hi does anyone know how to write an elasticity function in MX?

This works in 5 - but I want to use dynamic masking also - here's the code (slightly modified from Ilyas Usal. Ilyas is also known as ilyaslamasse )



MovieClip.prototype.move = function (centerx,centery,inertia,k) {

x = -this._x + centerx ;
y = -this._y + centery ;

xp = xp * inertia + x*k ;
yp = yp * inertia + y*k ;

_x += xp ;
_y += yp ;
}


this goes in the movieclip:


onClipEvent (load) {
newx = this._x;
newy = this._y;

}

onClipEvent (enterFrame) {

this.move (newx,newy,0.45,0.5);


}

then you can set newx and newy how ever you want buttons or timeline.

I need it to work in MX - any suggestions?


-DWC

View Replies !    View Related
Elasticity In Mx 2004
Hey guys I have been using mx 2004 for the last couple of days,
and i wanted to do the elasticity effect but it seems not to work. Heres the formula i use on flash mx...


var k:Number = .2;
var damp:Number = .9;
var tx:Number = 300;

ax += (tx-_x)*k
vx+=ax;
vx*=damp;
_x += vx;

Any ideas on how to make it work on mx 2004?

View Replies !    View Related
Boxes And Elasticity
I'm working on a new design for my portfolio site. I haven't decided if I like it yet or not. (the layout is at http://ajmoore.f2o.org if you wanna take a look and add any comments). But my question is about elasticity and boxes. What I want to do is start with a small square and have it expand to its planned size. Thats no problem, I can do that. But I've seen an effect on some sites out there (of course I can't find an example right now) where when the box expands, it kind of blows up beyond its new size and retracts back. Its not just a simple dimension change though, because the boxes sides actually expand, kind of like its about to morph into a circle but bounces back. I'm not sure how I would do that...Is there a property I can change to control the arc of the sides in action script? I'm still very new to flash so I'm sorry if this is a stupid question, but any help would certainly be appreciated.

Thanks,
AJMoore

View Replies !    View Related
Understanding Elasticity
I've been reading over and over the tuts on here by Pom, and Lostinbeta's experiment on elasticity and springy effects. I've even went through and read Penners' chapt.7 a few times. I still have know idea how I would adapt these methods to simply making a box appear out of no where, grow to a certain size, bounce past its limits, then retract. (you all know what I mean) I am not good with these equations at all, and don't know how to adapt effects like these. I know this is alot to ask around here, but if anyone can help me understand. Or even show an example of how I can make a box or shape do this on its own with a onClipEvent. As opposed to mc's following a mouse. Thanks if anyone replies.

View Replies !    View Related
Elasticity Question
Hi there,
I'm trying to create a menu which is comprised of little cards on strings. The viewer will be able to pull down on the cards and let them bounce up and down, but they shouldn't be able to drag the entire movie clip horizontally, just vertically. How do I do this? I've attached the movie, it's working, except for them not being able to drag the clip horizontally.
OR they can drag the clip horizontally, but not off the edge of the screen. . . don't know how to do that either.
Ayudame!
Au secure!
Help!

View Replies !    View Related
How Do I Slow Elasticity?
this is concerning the 3d spiral menu 1
i got it working great, but it jumps around way too much. is there any way i can get it to slow down and not be so jumpy?

View Replies !    View Related
Help With Elasticity And Borders
I tried having an elastic ball that follows the mouse, and make it bounce off borders. However, it sometimes goes beyond the borders. Here is the code:


ActionScript Code:
onClipEvent (load) {
    k = .02;
    inertia = .89;
    dx = 0;
    dy = 0;
    top = 0;
    bottom = 500;
    left = 0;
    right = 500;
    v = true;
    b = true;
}
onClipEvent (enterFrame) {
    ix = (_root._xmouse-this._x)*k;
    iy = (_root._ymouse-this._y)*k;
    dx += ix;
    dy += iy;
    dx *= inertia;
    dy *= inertia;
    if (this._x-this._width/2<=left) {
        if (v) {
            dx = -dx;
            v = false;
        }
    } else if (this._x+this._width/2>=right) {
        if (v) {
            dx = -dx;
            v = false;
        }
    }
    if (this._x-this._width/2>left && this._x-this._width/2<right) {
        v = true;
    }
    this._x += dx;
    if (this._y-this._height/2<=top) {
        if (b) {
            dy = -dy;
            b = false;
        }
    } else if (this._y+this._height/2>=bottom) {
        if (b) {
            dy = -dy;
            b = false;
        }
    }
    if (this._y-this._height/2>top && this._y-this._height/2<bottom) {
        b = true;
    }
    this._y += dy;
}


Attaching the code to any object should work. Thanks in advance.

View Replies !    View Related
Elasticity Is Not Working?
Hi,
I was working on applying elastic property to an object but it wasn't working so any one has some better script for this.

View Replies !    View Related
Elasticity Animation
http://www.neave.com/rant/

Click around the borders. Can anyone lead me in the right direction for coding some similar to this?

Thanks.

View Replies !    View Related
|netbabyworld |+| Elasticity|
Hi,

I am trying to get my head around some physics. I have looked at several examples of elasticity and inertia but can't understand it fully.

The effect i am tring to achieve is similar to one used on NETBABYWORLD. The interface for the game slides in and out of the screen for each section. I am trying to work out how to script an MC/MCs so it leaves the screen in the same way as the above example.

The object goes backwards slightly before shooting off screen with accelaration.

Any advice/code is greatly appreciated.

Thanks in advance.

Frank

View Replies !    View Related
Elasticity Buttons
I'm trying to create a navigation effect similar to the on J.D. Hodge's site http://www.gridplane.com .

I am having trouble with making the buttons bounce (have an elastic feel).

Any help on this would be GREAT!!!

Thanks,
-Michael

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved