Rotating Snowflake
Hi, I am trying to set up a movie on my webpage of a snowflake (taking up most of the screen) which when the page loads the snowflake slowly rotates into view. (hope that makes sense)
I am sure I saw using Flash that I can rotate something fairly easily, the part I am not so sure about is how to make it slowly appear. I don't want it to appear jerkily but smoothly as it rotates on the screen.
Are there any tutorials available which can help me achieve this? any help appreciated. Thanks in advance.
Tek-Tips > Adobe(Macromedia): Flash Forum
Posted on: 29 Sep 03 15:44
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Snowflake
Hello - I learned alot from the snow flake tutorial ( http://www.kirupa.com/developer/mx/snow2.htm )
Code:
onClipEvent (load) {
//specifies the size of the movie stage
movieWidth = 300;
movieHeight = 200;
//variables that will modify the falling snow
i = 1+Math.random()*2;
k = -Math.PI+Math.random()*Math.PI;
//giving each snowflake unique characteristics
this._xscale = this._yscale=50+Math.random()*100;
this._alpha = 75+Math.random()*100;
this._x = -10+Math.random()*movieWidth;
this._y = -10+Math.random()*movieHeight;
}
onClipEvent (enterFrame) {
//putting it all together
rad += (k/180)*Math.PI;
this._x -= Math.cos(rad);
this._y += i;
if (this._y>=movieHeight) {
this._y = -5;
}
if ((this._x>=movieWidth) || (this._x<=0)) {
this._x = -10+Math.random()*movieWidth;
this._y = -5;
}
}
My one questions is...I copied and pasted the exact code into another .fla file, and for some reason...the snow flakes fall straight down, instead of oscilating a little side to side
Author - Help!
Thank you
oops wrong Link...
btw what does that little red flag mean in the frame? I think that might be my problem, since it is the only difference. The movie clip from Kirupa has it, and mine does not
Make Your Own Virtual Snowflake
I found a great site which allows you to make your own virtual snowflake.
Does anyone know a site where i can get the fla or code for something similar?
http://snowflakes.lookandfeel.com/
Infinite Snowflake - Any Help V Much Appreciated
Hi, I’d really like to create something similar to this- http://snowflake.cogapp.com, for a Uni project, but I’m not sure where to start.
I’ve had some experience coding PHP and Actionscript, but not enough to know how to create something like that from scratch. If anyone could point me towards a tutorial or Flash file I could download and edit I’d REALLY appreciate it.
Many thanks in advance,
Lucy
Snowflake Tutorial Question
http://www.kirupa.com/developer/mx/snow.htm
How can I alter this code to work with a 100% width and height, and so that upon resize of the user's browser the code is updated to reflect that?
This would be for a site in which Flash fills the whole browser window.
Thanks!
Scripting A Snowflake Mask
How could I modify this code to keep the flakes from falling within 12px on all four sides plus a 22 radius on the corners. I could just load the swf into a master file to accomplish this but it's gonna be such a simple piece I was hoping there could be a way to just use code to do it. Also, this AS only works as 1.0 and Flash Player 6. Any clue how to upgrade it?
Code:
// snowflakes
amount = 100;
mWidth = Stage.width;
mHeight = Stage.height;
for (var i = 0; i<amount; i++) {
thisFlake = this.attachMovie("flake", "flake"+i, i);
with (thisFlake) {
_x = Math.random()*mWidth;
_y = Math.random()*mHeight;
_xscale = _yscale=_alpha=40+Math.random()*60;
}
thisFlake.yspeed = Math.random()*2+.2;
thisFlake.increment = -0.025+Math.random()*0.05;
thisFlake.radian = 0; //declare for actionscript 2.0
thisFlake.onEnterFrame = function() {
this.radians += this.increment;
//trace(this.radians);
this._x += Math.sin(this.radians);
this._y += this.yspeed;
if (this._y>=mHeight) {
this._y = -10;
this._x = -10+Math.random()*mWidth;
}
if (this._x>=mWidth || this._x<=0) {
this._y = -10;
this._x = -10+Math.random()*mWidth;
}
};
}
Trig Snowflake/bubble? Movement
This was origianlly posted in the math/phycis section, but no one reads that enough, so i'm posting it here:
Hey, I was wondering if anyone can help me out this code. I'm fairly new to OOP, but I can understand it pretty well (this code is not mine originally, though). The following code creates the effect of a falling snowflake. Create a movie clip called "snow" and add this code to it:
onClipEvent (load) {
//specifies the size of the movie stage
movieWidth = 700;
movieHeight = 700;
//variables that will modify the falling snow
i = 1+Math.random()*2;
k = Math.PI+Math.random()*Math.PI;
//giving each snowflake unique characteristics
this._xscale = this._yscale=50+Math.random()*100;
this._alpha = 75+Math.random()*100;
this._x = -10+Math.random()*movieWidth;
this._y = -10+Math.random()*movieHeight;
}
onClipEvent (enterFrame) {
//putting it all together
rad += (k/180)*Math.PI;
this._x -= Math.cos(rad);
this._y += i;
if (this._y>=movieHeight) {
this._y = -0.01;
}
if ((this._x>=movieWidth) || (this._x<=0)) {
this._x = -10+Math.random()*movieWidth;
this._y = -0.01;
}
}
note: to create multiple falling snowflakes, create a movie clip called "snow" and add the following code to the first frame of the timeline:
for (var k = 0; k < 50; k++) {
this.snow.duplicateMovieClip("snow" + k, k);
}
Anyway, can anyone find a way to reverse the direction of the snowflakes so that they float up, and possibly modify their properties so that the cosine wavelength is shorter, giving it the effect of bubbles floating upwards.
Thanks
Rotating Boxes-non-rotating Box/text
i have a rotating menu(boxes in circular motion). when a box is rolled over, all stop, but the text box that should appear in the middle between them, is not appearing where it should. it seems to be following the animation of its parent box.....any ideas?
jas
Moon Rotating Around Rotating Earth
I've got my earth revolving around the sun. I can't get the moon to revolve around the earth while it is revolving around the sun. Has anyone done this before, or is willing to help out?
Thanks
Rotating Menu With Non-Rotating Labels
I have a rotating menu that sets the selected button to the 3:00 position once clicked. I need the labels for the buttons to stay in the upright position as they rotate with the button. I have attached an image the help explain what I am trying to do. Anyone know of an action script that would keep the labels upright?
Rotating Mc
hi, anyone knows hows how to rotate a mc in circle using an action script instead of keyframing.
Thanx Giano
Rotating
I want to rotate a basic line, not from the centre but from one end, using the mouse_drag.
I want the line to move only within a certain range of angle.
does anyone know of how this is done or can anyone direct me to a tutorial for this.
Rotating
i found a web site sunday night that had an image of a plane or somethin cant excatly remeber what it was, but there were 3-4 of the same image. it would rotate in a circular motion til the next one was in front. couldnt find it tonight. does anyone know how to do that? i want to do some hearts the same way. please help. thanx
Rotating A MC
hi.
lets say i have a graphic of a box and i set the behavior as a movie clip and gave it an instance name of 'box'
and lets say i have a two buttons on the stage...
now my question is... what is the actionscript or how do i make it so button 1, when clicked, rotates the box 45 degrees clockwise each time its clicked and button 2 would make the box rotate counter clockwise 45 degress each time it is clicked?
Rotating A MC
hi.
lets say i have a graphic of a box and i set the behavior as a movie clip and gave it an instance name of 'box'
and lets say i have a two buttons on the stage...
now my question is... what is the actionscript or how do i make it so button 1, when clicked, rotates the box 45 degrees clockwise each time its clicked and button 2 would make the box rotate counter clockwise 45 degress each time it is clicked?
using flash 5
also.. how would i make a MC 'flip' horizontally or vertically when clicking a button?
Rotating
I have created a circle and I want it to continuously rotate. I have received many suggestions about what to include in the actionscript, but none of the suggestions have worked. I am a newbie when it comes to flash, but I am completely clueless when it comes to actionscripting. If someone could help me out I would greatly appreciate it.
The object is the outline of a circle. Here is the actionscript I have so far.
actions for the frame:
function rotate (circle) {
eval(circle).rotation += 2;
}
actions for object:
onClipEvent (enterFrame) {
_root.rotate(_parent);
}
the name of the instance is "circle"
Rotating JPG
I have been asked to create a rotating JPG image that pulls the filenames from a configuration file or that can pull the image filenames from a directory. This way, the images can be changed without updating the Flash file. Any suggestions?
Rotating
Hi,
I'm working on puzzle project for my site.
I was hit on the wall when i need to rotate puzzle. I dont know how to achieve these with actionscript.
I need make option for any piece of puzzle to rotate whet user click on any edge. And then start rotate it with mouse still pressed.
CAN ANYONE HLEP ME HERE ?
regards,
dbMG
Rotating ORB
Anyone have a tutorial or know how to do the rotating orb effect in flash?
Thanks
Prophecy
Help Me With Rotating
I have imported a PNG as an object. And I want to rotate it.
Now if i play it in Flash MX it looks fine and smooth, but if i play it externally (Ctrl+Enter) it looks awful! the animation speed is alrigt, but the quality of the rotation sucks - it's very blocky.
it looks very nice in MX but outside the resampling sucks. any ideas? - is there an option i need to turn on?
Rotating Box
To start off,
Hi. My name is Roger. 19years old, live in Norway.
Write PHP, graphics, and now I'm thinking about learning some simple flash.
I've used Swish, once upon a time, but who cares.
I want to create a rotating box. White, with black edges. So, the $10,000 question is, have I come to the right place?
Hope to get some good replies! Thanks
Rotating Box
To start off,
Hi. My name is Roger. 19years old, live in Norway.
Write PHP, graphics, and now I'm thinking about learning some simple flash.
I've used Swish, once upon a time, but who cares.
I want to create a rotating box. White, with black edges. So, the $10,000 question is, have I come to the right place?
Hope to get some good replies! Thanks
Rotating With AS
Hi,
I am still quite new to AS. I'd like to rotate a circle (compass_mc) around its centerpoint slowly forth/back with +/- 45 degree...or better randomly.
As file size is important, I can not solve it with MotionTween.
Up to this time I applied this code to the MC, which endlessly rotates it:
iranytu_mc.onEnterFrame = function(){
this._rotation+=1;
}
Do you have any idea how to apply that sort of random slow forth/back rotation to the circle with AS?
Many thanks,
Bacizone
Rotating
hey people does anyone know how to create this effect with the menu the coral
where you move the the slider to rotate the menu. or even if you click on a button and it rotates (one for left one for right) etc
Rotating
EDIT: I put [ as ] tags around your code - makes it much easier to read - jbum
Hi i have this code that tweens scale and position of a movieclip, and with my limited as knowledge have tried to make it rotate a movieclip too, alas to no avail. any help would be greatly appreciated!
code:
/*EASING ************************************************** ********************/
function ease (objet, targetX, targetY, speed) {
if(!easingArray) {
easingArray = [[],[]];
}
var found = false;
for(i=0; i<=easingArray[0].length; i++) {
if(easingArray[0][i] == objet) {
found = true;
if(easingArray[1][i] != objet._easing) {
clearInterval(easingArray[1][i]);
easingArray[1][i] = objet._easing;
};
if( (Math.ceil(objet._x) < ( Math.ceil(targetX - 1) ) ) || (Math.ceil(objet._x) > ( Math.ceil(targetX + 1) ) ) ){
objet._x += (targetX - objet._x)/speed;
} else {
objet._x = targetX;
};
if( (Math.ceil(objet._y) < ( Math.ceil(targetY - 1) ) ) || (Math.ceil(objet._y) > ( Math.ceil(targetY + 1) ) ) ){
objet._y += (targetY - objet._y)/speed;
} else {
objet._y = targetY;
};
if( (objet._x == targetX) && (objet._y == targetY) ) {
clearInterval(objet._easing);
};
};
};
if (found == false) {
var long = easingArray[0].length
easingArray[0][long] = objet;
easingArray[1][long]= objet._easing;
}
};
Movieclip.prototype.easing = function (targetX, targetY, speed) {
trace("ease");
clearInterval(this._easing);
this._easing = setInterval(ease, 40, this, targetX, targetY, speed);
}
/************************************************** ***************************/
/** RESIZE ************************************************** *****************/
function resizeMC (objet, X, Y, speed) {
trace("Resize");
if(!resizeMCArray) {
resizeMCArray = [[],[]];
}
var found = false;
for(i=0; i<=resizeMCArray[0].length; i++) {
if(resizeMCArray[0][i] == objet) {
found = true;
if(resizeMCArray[1][i] != objet._resize) {
clearInterval(resizeMCArray[1][i]);
resizeMCArray[1][i] = objet._resize;
};
if( (Math.ceil(objet._width) < ( Math.ceil(X - 1) ) ) || (Math.ceil(objet._width) > ( Math.ceil(X + 1) ) ) ){
objet._width += (X - objet._width)/speed;
} else {
objet._width = X;
};
if( (Math.ceil(objet._height) < ( Math.ceil(Y - 1) ) ) || (Math.ceil(objet._height) > ( Math.ceil(Y + 1) ) ) ){
objet._height += (Y - objet._height)/speed;
} else {
objet._height = Y;
};
if( (objet._width == X) && (objet._height == Y) ) {
clearInterval(objet._resize);
};
};
};
if (found == false) {
var long = resizeMCArray[0].length
resizeMCArray[0][long] = objet;
resizeMCArray[1][long]= objet._resize;
}
};
Movieclip.prototype.resize = function (targetX, targetY, speed) {
trace("rez");
clearInterval(this._resize);
this._resize = setInterval(resizeMC, 40, this, targetX, targetY, speed);
}
/************************************************** ***************************/
/** rotation ************************************************** *****************/
function rotationMC (objet, rotation, speed) {
trace("rotation");
if(!rotationMCArray) {
rotationMCArray = [[],[]];
}
var found = false;
for(i=0; i<=rotationMCArray[0].rotation; i++) {
if(rotationMCArray[0][i] == objet) {
found = true;
if(rotationMCArray[1][i] != objet._rotation) {
clearInterval(rotationMCArray[1][i]);
rotationMCArray[1][i] = objet._rotation;
};
if( (Math.ceil(objet._rotation) < ( Math.ceil( - 1) ) ) || (Math.ceil(objet._rotation) > ( Math.ceil( + 1) ) ) ){
objet._rotation += ( - objet._rotation)/speed;
} else {
objet._rotation = rotation;
};
if( (objet._rotation == rotation) ) {
clearInterval(objet._rotation);
};
};
};
if (found == false) {
var long = rotationMCArray[0]._rotation
rotationMCArray[0][long] = objet;
rotationMCArray[1][long]= objet._rotation;
}
};
Movieclip.prototype.rotation = function (rotation, speed) {
trace("rot");
clearInterval(this._rotation);
this._rotation = setInterval(rotationMC, 40, this, _rotation, speed);
}
/************************************************** ***************************/
this.btnR.onRelease = function () {
trace("coucou");
MC1.resize (200, 200, 10);
MC2.resize (200, 200, 10);
}
this.btnRE.onRelease = function () {
MC1.rotation (180, 10);
}
this.btnE.onRelease = function () {
MC1.easing (10, 250, 50);
MC2.easing (250, 250, 50);
}
this.btnReset.onRelease = function () {
MC1.resize (100, 100, 10);
MC2.resize (100, 100, 10);
MC1.easing (17, 19, 10);
MC2.easing (202, 25.9, 10);
MC1.rotation (0, 10);
MC2.rotation (0, 10);
}
Rotating 3D
Hi.
http://www.korsmyrasnickeri.se/3dvis/3duf1_2.htm
Does anyone know how to create this effect? Is there a script to use somewhere?
I have the rendered 3D-images, I just want to script it so that it rotates with the cursor, frame by frame.
TIA
/housefly
Rotating X,y
Hi,
what maths/code would I use to apply a rotation of n degree's to x, y coordinates?
thanks
boombanguk
Better Way Of Rotating?
Ok, quick question. I have to rotate 4-10 balls during a game and when I do this, the fps drops from 50 to 32 (using 4 balls). I tried having them only rotate every 3 or 4 frames, but it only helped a few +fps but it looked horrible. Is there a better way to do this?
Rotating Gif
hi there,
i would like a gif to rotate, spin constantly if possible.
if you visit this page , http://www.tweedmill.co.uk/newA/cafe.html
you will see and circular image displaying "Les Routiers ". At the moment its static but i would love it if it could rotate.
could anyone help me with this?
cheers
Rotating Mc
Hy guys me again. Have another problem which I cant solve. The problem is that i would like to rotate my mc on the press of a button. But i cant. The transition works the way i want it to but the problem is that it starts in the end ad finishes at the begging. if t change the IN to OUT works perfectly but disappears on the end or jumps to the beginning.
Can anyone help me. I didn't put any code in because noting works
my_mc.rotation = 90; works but there is no animation in between 0 and 90 degrees.
tnx in advance
GP
Rotating On The.. Erm.. Z...? X....? Y...?
I would like to be able to do this:
http://www1.ap.dell.com/content/products/productdetails.aspx/xpsdt_710?c=au&cs=audhs1&l=en&s=dhs
Do I need any special plugin?
I realise one of the steps is taking photos, but how do I stitch them together in Flash?
On a side note, has Flash CS3 been released yet?
3D Rotating Box?
Does anyone know of a way to create a Box with 4(maybe more) sides that can/will rotate... then pause on a side... rotate... then pause on a side... etc.?
I see this Flash Component at FlashLoaded.com but I'm not sure if it's correct. Looks like a 3d box but...
I would like my box to be a Rectangle that has links to 'Movie 1' - 'Movie 2' - 'Movie 3' - etc.
That's why I want to build it with a Pause. This is to give the user time to Click the Link.
All help is greatly appreciated.
Rotating 360
Ok so I want to rotate a picture in a complete circle, how is this done rather than doing it using motion tween? what action script would be best?
3D Rotating Nav
Found this menu idea that I would like to experiment with, but I'm not too good with math in flash yet.
Question: Is it possible to make this menu rotate horizontally instead of vertically?
I've fooled around with a bunch of other horizontally rotating menus, but I like this particular idea the best and would like to see what it looks like as a horizontal menu.
thanks.
Rotating MC
hey,
I searched the forums and found a few threads, but they didn't seem to give me the information I needed.
I have this as my menu, which I would like to rotate (as you might see)
The squares on uses this code to glide around the stage:
//determines how fast the MC morphs
onClipEvent (enterFrame) {
power = 6;
}
//makes the MC "sqaure" morph into the size the 'button' specifies
onClipEvent (enterFrame) {
if (_root.squareONEx) {
speedx = (_x-_parent.squareONEx)/power;
speedy = (_y-_parent.squareONEy)/power;
_x -= speedx;
_y -= speedy;
}
}
Id like to put them into a new MC and add a code, so that the texts get displayed right. No matter which rotation its at.
Can anybody help me with this.
They need to be rotated 0 degrees, 90 degrees, 180 degrees and 270 degrees ccw to display the text rightly, as you can see.
Hope somebody can help me with a script here.
Thanks VERY much in advance
Morten Rosenberg
Rotating Help
Anyone know how to make a MC point (rotate) to where the mouse was clicked on stage ?
Rotating A MC
ok, i'd like to have a circle with pic contained within it. I'd like to rotate the circle but have the picture always remain right side up as the circle rotates (like a viewmaster, that will be the final navigation). I'm kinda lost on just how to achieve this effect. Any help would be greatly appreciated.
Thank you.
tim
[as2] Rotating Mc
Hey all,
hope you can help me...
I would like to rotate a parent mc, every time the child mc hits frame 31.
If I use this._rotation=+10, once the mc hits frame 31, the mc rotates non-stop.
I want it to rotate only 10 degrees - once - everytime it hits frame 31.
Bless me with thoust knowledge
-adam
Rotating Cog
Would anyone know where or how I could make a 3d turning cog ?
I am looking for the cog to look something like this -> http://spaciest.com/cog.gif
Any help will be much appreciated
Rotating Menu
Hi everyone, im looking for some help. im using a rotating menu on my site, which i got from a tutorial from this site.if anyones familiar with it you maybe able to help me. basically the menu spins depending on where the cursor is on the movie so if the mouse is in the top half of the movie it spins up,and the same for down. it also enlarges if you go closer to the menu. this is what i want to stop. i want the spinning menu but i dont want it to enlarge.im very new to this actionscipt so all help would be appreciated. you can see what ive done so far on the front end of my site.
http://www.purplesquare.net
its very new and doesnt have much on it but watch this space for the future.
also there a forum on my site which you can register, just like here,and you can post messages there so give it a go.
thanks in advance
melv
Get X Value Of Rotating Graphic
Not a problem you would think..
I would like to get the x value of a ball MC, which is contained in a movieclip that's rotating via an enterframe clip event.
i.e.
I have a moviclip called "ball" which is located in a moviclip called "rotate", this actionScript is on the clip event of "rotate".
onClipEvent (enterFrame) {
setProperty ("_root.rotate", _rotation, _rotation+10);
..:xBall = getProperty("-root.rotate.ball", _x);
}
However this appears to return a value of x IN RELATION to my rotate MC, i.e. it's a static value.
Is there a way of getting Flash to return properties in relation to the stage, or do I have to hit that maths books again!
I tired using a controlClip insted of the clipevent script but that gave me a very strange x value????
Thanks for any pointers in advance,
Stu
Rotating And Shrinking
Why do my movie clips that are rotating using actionscript allways shrinking after some time and is there a way to fix that?
Rotating And Shrinking
Why do my movie clips that are rotating using actionscript allways shrinking after some time and is there a way to fix that?
Rotating A Gun And Fireing.
We are making a game with a gun that we wish to rotate and fire out of. We are able to rotate the gun but are having trouble getting a movieclip to move from the gun in the correct angle and continue to go at the same angle. Please help!
3D Rotating Interface
I have designed a 3D rotating interface that moves according to the mouse position - similar to the one used on http://www.egomedia.com in the 'process' section. I have 8 panels, and am using the swapDepths action to make it so that when one panel is infront of another it's level is greater and therefore the proportion of the back panel covered is hidden. However, I want the part of the back panel covered by the front panel to have a reduced alpha rather than be completely hidden. How do I do this? I can't work out how to do it by changing the levels using swapDepths - is there another method?
Thanks for your time,
Shaka
Rotating MC - Mouseover?
Help will be appreciated.
I have a rotating MC (using tween). How can make it stop with mouseover?
Rotating 3d Navigation
I need an Fla,Or Director file for a navigation system as similar to
http://www.kerb.co.uk (look in the services section)
http://www.navihedron.com
Or any links to a Director site with forum...
Many Thanks
C
Rotating Object
how can i rotate an object non-stop?
Can anyone pls helpppppp
W.
Rotating Dial
Does anyone know where I can find a rotating dial? I found one that rotates the dial 360 degrees, but I only need it to rotate 180 degrees. Here's the ActionScript. I don't know if anyone can help.. thanks..
// these functions get called in the
// onPress and onRelease action of the
// knob button
function startRotate () {
state = DRAGGING;
}
function stopRotate () {
state = COASTING;
}
function getRotationFromMouse () {
// Set Up initial variables
someNum = 0.0175;
Xpos = _root._xmouse;
Ypos = _root._ymouse;
circleXpos = _x;
circleYpos = _y;
x = Xpos-circleXpos;
y = Ypos-circleYpos;
r = Math.sqrt((x*x)+(y*y));
// too far from the center of the radar
// stop the dragging
if ( r > _width<<2 ) {
return 0;
}
sinTheta = y/r;
theta = Math.asin(sinTheta);
// check quadrants & do the rotations
if (Xpos < circleXpos)
val = (180-(theta/someNum)+90);
else if (Xpos>circleXpos)
val = (theta/someNum+90);
return val;
}
function setRotation ( angle ) {
knob._rotation = angle;
m_lastRotation = m_rotation;
if (knob._rotation < 0 )
m_rotation = knob._rotation + 360;
else
m_rotation = knob._rotation;
m_rotationDiff = m_rotation - m_lastRotation;
if (m_rotationDiff < -200 )
m_rotationDiff += 360;
if (m_rotationDiff > 200 )
m_rotationDiff -= 360;
lg_wedge._rotation += m_rotationDiff/6;
}
function checkRotation ( ) {
//zeroAdjust = 90;
rotation = knob._rotation;
if (rotation < 0 )
rotation += 360;
// HERE YOU CAN CHECK THE KNOB's ANGLE
return 0;
}
Rotating Cubes Anyone?
hey guys...i'm sure we've all seen many rotating cubes out there, and lots of tutes on creating them, but so far i've only come across wireframe cubes and scary chunks of 3d maths.
I need to create a filled rotating cube that rotates left and right according to the direction of the mouse. anyone can help me? is there an easy yet effective way of achieving it? or must I start reading up on 3d maths...*gulp*
please help!
|