Random Confetti script
I have a ton of icons 100x100 and I made a droplet to import them into a document as separate layers and make them 125X125. I now need to make all of the images look like they are falling out of a hole, like confetti squares. is there a way I can make each layer look like it is falling, randomly ( I don't want each image to have the same perspective.) If some one could script this, that would be great. I am almost clueless when it comes to java script. Or if someone could tell me how to do this with an action that would be great to. I really do not want to change more than 1000 layers separately.
You could try attached Script at Your own risk.
I tried it of course, but with Scripts it’s pretty easy for me to overlook stuff.
Edit:
This Script only randomly redistributes, scales, rotates and skews the SO-layers in a layerset, so actually it does not provide perspectival shortening.
And what may be more of a problem: it does so randomly, meaning that the topmost layers may end up smaller than lower layers, which, assuming that all the pieces of confetti are supposed to be of about identical size, would appear implausible.
I suppose one could either forgo the randomness of the rescaling completely and scale according to layer-order or limit the amount of randomness.
Similar Messages
-
Suggestions for simple random image script
Would like to randomly display one of five new JPG banner each time page is loaded.
Your experience would be appreciated.
ThanksSince no one replied, I am posting solution I found.for future inquiries.
Simple PHP Random Image Script
This can be done in one line of text directly in your HTML and a collection of images.
The first step is to gather together the images you wish to have randomly rotated.
Change all of their file names to a numerical order, starting with the number 1.
* 1.jpg
* 2.jpg
* 3.jpg
* 4.jpg
Be sure each image has the same extension (either all jpg, png, or gif),
and that there are no gaps in the numbers.
Also, place these images in their own folder to keep everything organized.
Write the Code
In the HTML of your page, insert the following code where you want an image to display:
<img src="path/<?php echo rand(1,n);?>.jpg" alt="Random Image" />
The “rand” operator will display a randomly generated number between 1 and ‘n’.
Change ‘n’ to the total amount of pictures you have arranged numerically
(or the highest numbered picture you have).
In the example above I only have 4 pictures, therefor I would change it to: rand(1,4); -
I'm looking for a random quote script for my website?
So I've got a very large numbered list of quotes. I want to set up a little text thing on my website's homepage so it displays a randomly selected quote from the list which changes every day. Can anyone write me a script to do this? I had one, but it stopped working and no one's been able to help me fix it (I've tried to get help with that more times than I care to remember) and I decided that it would be better to just get a new script.
I have a random script, but it also seems to not be working the way it was originally written, it now outputs a number 1 along with the intended output.
Take a peek here, there is a rotator script I am about to use on a site I am workng on.
http://www.marcofolio.net/
Gary -
I'm creating a small movie with a set of random images that all appear in the same spot (no horizontal or vertical movement). I want each image to appear onscreen for two seconds, then be replaced by another randomly-chosen image. There are 17 images in the set. Here is the script I'm using:
on enterFrame
channel=random(17)
_movie.delay(2*60)
on exitFrame
go to the Frame
end
This script works well. However, because the population is small - only 17 - what happens when I run the script is that a little too often it randomly chooses the same image once, twice, sometimes up to five times in a row, which gives the effect that the movie is either stuck or not working properly. I would like to find out how to modify the script so that on exitFrame it chooses randomly any of the other 16 images but not the current image. At first I thought if the script read random(16) or random(17-1) that might work, but it doesn't.
Any thoughts would be welcome.
DallasHi Sean,
This randomizing project of mine is becoming more complex than I first realized and I now have another question that I hope you might be able to help me with.
The project breaks down into class, category, group and member. There are 9 classes (and perhaps a possibility in the future that further classes could be added). The structure and naming convention within each class is identical down to the member level. For example, Cat. 1 of Class 2 and Cat 1 of Class 7 both have the same names. Group 3 of Cat. 1 of Class 2 and Group 3 of Cat 1 of Class 6 both have the same names. However, the members of these groups do not have the same names.
In each class there are 4 categories, each with a different name. Each category contains a number of groups (each group has a different name). Each group contains a number of members. Each member in categories 1 and 2 is a bitmap image. The total number of bitmap members in the project is 21.
To give a fictionalized example (this project is not about clothing, but I'm using it as an example):
Class 1 = shirts
Class 2 = hats
Class 3 = pants
Class 4 = socks
Class 5 = shoes
etc.
Category 1 = British
Category 2 = Japanese
Category 3 = Turkish
Category 4 = Brazilian
Group 1 = Cotton
Group 2 = Synthetic
Group 3 = Speed
Group 4 = Sound
and so forth.
In Class 1 (shirts) there are British, Japanese, Turkish and Brazilian shirts and these could be made of either cotton or synthetic. In addition, there are a variety of speeds and sounds from which to choose when displaying the shirts.
In my project:
Cat. 1 has 7 groups and each group varies in the number of members with either 7, 14 or 21 (but no other alternative to these numbers).
Cat. 2 has 13 groups and each group has 7 members.
Cat. 3 does not randomize images but lets me choose any one of 12 different speeds for randomization in half-second increments.
Cat. 4 does not randomize images but lets me choose any one of 6 different sounds. Whenever the randomized image changes, this triggers the sound. The sound is not randomized but is consistent once the choice for what KIND of sound has been made. In short: tick, tick,tick, or tock, tock, tock but not tick, tock. It is possible that in the future more sounds could be added.
Navigation should allow me to start with any of the four categories. For randomization to work, I must choose within either Cat. 1 or Cat. 2 (but not both) and I must make a choice of some sort within Cat. 3 (speed of randomization) while Cat. 4 is entirely optional (sound on or off, but not required to be on and, if it's to be on then choice for which kind of sound).
There are also an additional two buttons for sound on or off than run the length of the score within any class, meaning that while randomization is occuring anywhere within a class, I can choose to turn the sound on if it's currently off or off if it's currently on. Turning it on while randomization is taking place will also probably require a choice of which kind of sound (meaning a floating window I suppose) so as not to exit the frame where randomization is taking place.
Now for my question: should I create one massive behaviour script for all classes that includes a series of nested if/else statements for each category, group and member, or should I create 4 large behavior scripts, one for each category with if/else instructions for its groups and members, or should I script at the group level, which will result in 180 separate behaviour scripts for image randomization plus additional scripts for speed and sound?
Further, I understand how to apply at the group level the script you gave me earlier (and it works beautifully), but if you think it would be more efficient now to work at the category or class level, I'm not sure how to script the if/else statements. I'm assuming that in whichever of these solutions turns out to be best, it is applied to a single sprite which will serve to display the randomly-chosen image. Bear in mind that the script you gave me randomizes the image change every two seconds. Now I'm looking to have a choice of it changing within a range of once every half-second to once every 5 seconds (e.g. 0.5 sceonds, 1 second, 1.5 seconds, 2 seconds, etc.).
An ancillary question: could this be done a different way? A friend suggested using subroutines but wasn't able to tell me how to do this because he doesn't know anything about Lingo. I was wondering whether the if/then syntax structure is Lingo's way of doing subroutines.
Your thoughts would be most welcome. If you think you can't help me with this, do you have any suggestions as to where I might turn for help (apart from the nuthouse at this point)?
Cheers,
Dallas -
Random MovieClip script not selecting from all possible outcomes
i have a collection of movie clips (mc0, mc1, mc2...etc etc),
and when motion is detected on a webcam, one of these clips is shown on the stage.
however, for some reason only mc0, mc1 and mc2 are being displayed,
and i cannot get mc3, mc4 or any more to be chosen.
Code:
import flash.filters.*
// Assumes a Video object named "myVideoObject" is on the Stage
active_cam = Camera.get();
filterList = [
/* 0 */ "multiply",
/* 1 */ "multiply",
/* 2 */ "multiply",
/* 3 */ "multiply",
/* 4 */ "multiply"
positionList = [
/* 0 */ {_x: 512, _y: 288},
/* 1 */ {_x: 512, _y: 288},
/* 2 */ {_x: 512, _y: 288},
/* 3 */ {_x: 512, _y: 288},
/* 4 */ {_x: 512, _y: 288}
myVideoObject.attachVideo(active_cam);
active_cam.setMotionLevel(95, 100);
active_cam.onActivity = function(mode)
trace(mode);
var randId = Math.floor(Math.random() * 5);
var init = positionList[randId];
/* old init... {_x: Math.random() * _root._width, _y:Math.random() * _root._height}; */
var depth = _root.getNextHighestDepth();
var movieId = "mc" + randId;
if(mode) {
var mc = _root.attachMovie(movieId, movieId + depth, depth, init);
mc.blendMode = _root.filterList[randId];
I had the first three working fine, so when i added 2 more to the Filter and position Lists, and changed
the Mathrandom mutliplier to 5 instead of 3, i thought that would work.
Im really stumped, id like the script to choose from many more than 3 movie clipsYou should put a trace to check the movieId value to confirm that the code calls for movies > 2.
The random selection code should be fine as is, so you may have to wait a bit to see one of the movies you say is not displaying. If you were to increase the number of them, the chances of seeing some in the range > 2 is better. The only thing I can think of from your code that might prohibit showing something > 2 is the mode value, since that's the only thing that prohibits display of anything.
I am not at all familiar with video cams andactionscript regarding them, but would it be necessary to clear out the current mc# from being present/active before adding a new one? -
Need Random Image Script with Links
I am needing a script for random images on my homepage. I
need the image to have its own link depending on what image is
displayed. I would like a php script (non database) if
possibleSee comments on DW forum about random includes and this
particular markup
shown below.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"newhorizonhosting.com" <[email protected]>
wrote in message
news:e29on1$buf$[email protected]..
>I figured it out by doing a random include
>
> <?
> srand(time());
> $random = (rand()%3);
> print("$random");
> require_once("./$random.php");
> ?> -
Need Random Image Script with Link
I am needing a script for random images on my homepage. I
need the image to have its own link depending on what image is
displayed. I would like a php script (non database) if
possibleNot sure about the PHP but there are some good scrips on
www.kaosweaver.com
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"newhorizonhosting.com" <[email protected]>
wrote in message
news:e28rpm$8is$[email protected]..
>I am needing a script for random images on my homepage. I
need the image to
>have its own link depending on what image is displayed. I
would like a php
>script (non database) if possible -
hi all :)
i want to create a random card picker and this script works great for me. but how can i add clickable links to cards after they are generated randomly? i want the new image generated in the same place where 0.jpg is when button is clicked exactly like in the script, but with a clickable link on it.
thanks in advance :)
<script language="javascript">
<!-- Begin
function show(){
var theImages = new Array()
theImages[0] = 'deck/card1.jpg'
theImages[1] = 'deck/card2.jpg'
theImages[2] = 'deck/card3.jpg'
theImages[3] = 'deck/card4.jpg'
theImages[4] = 'deck/card5.jpg'
theImages[5] = 'deck/card6.jpg'
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer.src = theImages[i]
var whichImage = Math.round(Math.random()*(p-1));
document.picture.src = theImages[whichImage];
}// End -->
</script>
<img src="deck/0.jpg" name="picture" />
<form>
<input type="button" value="pick a card" onclick="show()">
</form>Java is not the same as JavaScript.
Try posting your question in a [JavaScript forum|http://www.google.com/search?q=javascript+forum]. -
How can I randomize a sound (a beep) to sound randomly, indefinitely in script form?
Are you looking for a script that makes random noises in the background, or a script that messes with the system settings and causes other applications and tools to make random noises? I'll assume the former.
Not a beep, but certainly related is the bash command:
say "Hello"
Here is a longer example, and wraps a version of the above bash in some AppleScript.
$ /usr/bin/osascript << EOS
say "Hello $USER"
EOS
There are other options. Commands include printf "\a", tput bel, echo with a ^G in the string, bash invoking AppleScript via osascript -e "beep 1", etc. Even if the audible bell is enabled in Terminal.app, these alert mechanisms can be set to very low levels or disabled entirely, depending on local settings for alert sounds within System Preferences > Sounds > Sound Effects.
Here is a one to ten second random sleep in bash:
sleep $[ ( $RANDOM % 10 ) + 1 ]s
Apple also has a Shell Scripting Primer available, and there are various AppleScript sites around.
Caveat: If the system involved is not your computer, then be very sure you want to proceed with this.
Inferring one of the common reasons for this request and particularly if this isn't your system, then this activity is right on the edge of what may be criminally prosecutable in some jurisdictions under the usual sorts of "unauthorized access" phrasing included in the statutes, even if this is a friend's system and was only intended as a "prank".
If this arrest and prosecution does not occur, you can still easily end up distancing yourself from your friend here. Computer intrusions can be very personal matters. -
I am now about to embark on my 3rd concept for scripting a random play DVD. Basically the issue I keep running into is that I have too many pieces of media (81 to be exact) that need to play and it's pushing DVDSP further than it is capable of going.
My first script had too many commands (1 jump for each track based on a random GPRM setting), so it failed on the build. Inspector shows 323 commands, and I am in the negative by 19 commands remaining. Looked like this:
ran GPRM 0, 80
Goto 1 if (GPRM 0 = GPRM1)
mov GPRM 1, GPRM 0
Jump Track 1 if (GPRM 0 = 1)
Jump Track 2 if (GPRM (0 =2)
and so on and so forth until
Jump Track 81 if (GPRM 0 = 80)
Second script had only 4 commands, all the clips in one track and each chapter's end jump pointed to the script. 81 markers/end jumps so that's over the limit of 106 chapter markers and individual chapter end jump settings per track as detailed here, http://docs.info.apple.com/article.html?artnum=93681
Script Looked like this:
ran GPRM 0, 82
Goto 1 if (GPRM0 = GPRM 1)
mov GPRM 1, GPRM 0
Jump Track 1 [GPRM 0]
So both of these work in theory and in simulator, but they can't build due to their excessive nature. Any thoughts on a randomizing script that can accommodate 81 clips? I am really struggling here to come up with new ideas and could use some help. Deadline looms! TIA!
Message was edited by: Evan ScheckHi Evan,
The DVD-Video Specifications provide a way to randomize playback, with no programming/scripts, almost unlimited numbers of programs (segments of a Track divided by markers). Randomizing up to 99 is a piece of cake - but it takes getting a license of DVDAfterEdit.
You start in DVD SP, of course, and then after the Build, adjust the Title PGC with your clips divided by program (marker) into what's called 'Shuffle" mode. There's a few another tweaks, but in short order you now have a Title PGC (Track Program Chain) that will randomly play all the clips, with no repeats. Navigation is lightning quick, because playback never has to seek the IFO file at the head of the VTS (Track), or the VMG at the head of the disc (slows playback waaaay down).
Anyway, just thought I'd mention it since you seem so determined.
Here's a recent thread over at the DVDAfterEdit site that goes over the concept:
http://www.dvdafteredit.com/node/1771#comment-1886
And also, here's the thread back in 2005 where Jake and Ben are helping me test the settings for the 100% compatibility that we achieved (and proved Sonic Solutions wrong on some points with this feature :-):
http://dvdafteredit.com/node/673
Take care,
Trai
Trai Forrester
TFDVD Research Labs
DVD Verification and Proofing
Entering 10 years of full-time, professional DVD Studio Pro troubleshooting and support -
AS Random letter script not working
I have the Flash AS Bible and one of the exercises is to
create a random letter displayer. I am not getting any errors in my
AS code, so I believe I have that o.k, but when I test movie I only
get a blank screen. One part I am unsure about is "using the text
tool, add an authoring time dynamic TextField object offstage on
the embedded font layer.
I see ta dynamic text box created, but I am not sure about
the rest. I also have it in the embedded font layer.
Also this part. "Open the Character Embedding dialog box and
choose the "specify ranges" option and the value abcdef in the
"include these characters" field.
I see the character embedding dialog box, but not the option
to choose "specify ranges". I do see the "include these characters"
field.
Someone please explain what I may be doing wrong.
Also just FYI herre is the AS code:
//Create the array of letters.
var aLetters:Array = ["a", "b", "c", "d" , "e", "f"];
//Set the interval at which a new letter should be displayed.
var nDisplayInterval:Number = setInterval(this,
"displayLetter", 1);
//Define an associative array to store data about ecach
letter.
var oLetters
bject = new Object();
function displayLetter():Void {
//Create a random integer to yield one of the indices from
the
//aLetters array.
var nRandomIndex:Number = Math.floor(Math.random()
*aLetters.length);
//Create random numbers to use for x and y coordinates of
// the letter TextField.
var nRandomX:Number = Math.random() *550;
var randomY:Number = Math.random() *400;
//Get the next available depth;
var nDepth:Number = this.getNextHighestDepth();
//Create a new Textfield object at the random x and y
//coordinates.
var tLetter:TextField = this.createTextField("tletter" +
nDepth,
nDepth, nRandomX, nRandomY, 0, 0);
//Set the autosize and text properties so the random letter
displays
tLetter.autosize = "left";
//Set the text.
tLetter.text = aLetters[nRandomIndex];
//Initialize the _alpha property to 0.
tLetter._alpha=0;
//Tell Flash to embed the font for the TextField.
tLetter.embedFonts = true;
//Define a new object into which to store some data for the
letter.
var oLetter
bject = new Object();
//Assign the object to the oLetters assocaitive array usimg
the instance name
//of the TextField object as the key
oLetters[tLetter._name] = oLetter;
//Set a element called fadeDirection that determines
//the increment by which the alpha will change. And set the
//alpha to 0 initially.
oLetter.fadeDirection = 5;
//Define an element that references the TextField.
oLetter.letterField = tLetter;
//Create a TextFormat object that tells Flash to use the
//Verdana font and sets the size to 15.
var tfFormatter:TextFormat = new TextFormat();
tfFormatter.font="Verdana";
tfFormatter.size= 15;
//Assign the TextFormat to the TextField.
tLetter.setTextFormat(tfFormatter);
//Set an interval at which the letter will fade in and out.
Assign the ID
//to a property of the oLetter onject so we can clear it
later. Pass the
//alphaFade() function a reference to the oletter object.
oLetter.interval = setInterval(alphaFade, 10, oLetter);
function alphaFade(oLetter
bject):Void {
//Retrieve the TextField object reference.
var tLetter:TextField = oLetter.letterField;
//Increment the letter TextField's alpha.
tLetter._alpha += oLetter.fadeDirection;
//Check to see if the letter has faded in completely. If so
//set the fadeDirection property to -5 so that The TextField
//Starts to fade out. Otherwise, if the letter has faded out
//completely clear the interval and remove the TextField.
if(oLetter.fadeDirection > 0 && tLetter._alpha
>=100) {
oLetter.fadeDirection = -5;
else if(oLetter.fadeDirection < 0 &&
tLetter._alpha <=0) {
clearInterval(oLetter.interval);
delete oLetters[tLetter._name];
tLetter.removeTextField();
//make sure to update the screen.
updateAfterEvent();
thanks!Sounds ok but here is how you do that.
With the text tool selected, draw a text box anywhere you
like but not on the stage. Using the property inspector set the
text field to be dynamic. Type some text in the text field, select
it and using the property inspector, select Verdana for the font.
In the property inspector click 'embed' and select the character
sets you want to embed or just use the "include these characters"
field to embed the characters you are using in your aLetters array.
If you do not embed the font, you'll get a blank screen. I've
tested the code and it works properly. -
Tutorial announcement .:: Building Random Quote Script ::.
Hello everyone...
today in this tutorial we will make an easy and fast :: random quote application :: this application will help you to retrieve random data from your database, text, images, links, with un sorted order.
if you have very large number of records in your database and hardly find the way to sort them, the best way is to randomly view it.
this application contains:
1- Insert new record to the database.
2- view random text each time you refresh your page.
:: Go to tutorial ::
:: Online Demo ::Hi Purple Edge,
it would be great if you could figure out a way to determine file size before attempting an upload.
PHP can only access file data (e.g. size) after it´s been uploaded -- one would have to use Flash for this, as this technology is indeed capable to check such data immediately.
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver -
Random Image not displaying in Live View.
My page is at:
www.andrewjamesartist.co.uk
There's a random image script on the front page.
<img src="randomimages/rotate.php" alt="A Sample Image from the work of Andrew James" />
That's how it is placed in the page.
It shows in preview in browser and it's OK live but it doesn't show in LiveView.
I use a testing server set up with virtual hosts.
MartinMy page is at:
www.andrewjamesartist.co.uk
There's a random image script on the front page.
<img src="randomimages/rotate.php" alt="A Sample Image from the work of Andrew James" />
That's how it is placed in the page.
It shows in preview in browser and it's OK live but it doesn't show in LiveView.
I use a testing server set up with virtual hosts.
Martin -
I am using a
PHP random image
script on a site in which I have 2 different images on each
templated page (random images throgh a site). The two images call
to 2 different folders with the random image script in them (to get
2 distinct images). Thus, 2 different random images. My issue is
that it seems that most browsers at some point do not call for a
new image but use what was there in the last page as it is the same
name:
http://ansano.com/asl/images/random/top/random_image.php
or
http://ansano.com/asl/images/random/bottom/random_image.php
Any idea of how to force a browser to call the PHP script? Or
how to change it so it works site wide?
Thanks!!I've now been sitting looking for this for a while. I don't seem to be able to get it to work.
Do I need to host to a folder first and then to the FTP server after?
I don't seen to be able to find the new page (TEST PAGE) in the folder I used to publish the site to before I went online. Tried searching for it in finder but I don't get any results on (TESTPAGEfiles).
I can see what you are talking bout I only publish to a local folder but I want to publish via the FTP option in iWeb.
Thank you very much for helping me -
Prevent function access between 2 scripts
Hello,
I have a understanding problem with InDesign JavaScript Engine.
I have two simple Scripts.
Script 1:
alert(random(100));
function random (max) {
return Math.floor (Math.random() * max);
Script 2:
alert(random(100));
If I execute the Script 1 it is works fine.
If I execute the Script 2, it finds the function "random" from the Script 1.
How I can prevent this ?
I have tested #targetengine, #engine and #script.
mfg
mpd323If you execute Script1, then Script2, in the same persistent engine, the function random that you declare in Script1 is available in Script2.
What's the problem?
Do you need to use a different random function in Script2?
You may add a #targetengine 'Script1' directive in Script1, and a #targetengine 'Script2' directive in Script2, to separate each process. (In this case, random need to be defined in Script2).
If you use the same #targetengine, you can ‘overwrite’ random in Script2 by using something like:
this.random = function() {/*Script2 random stuff*/}
but that's probably not what you want...
Finally, what don't you use random1 in Script1 and random2 in Script2?
If you really need two distinct functions, create two distinct functions!
Maybe you are looking for
-
Hi Guys, I have a With CTE table expression ,this cte gets the value from startdate and enddate I need to insert this startdate and enddate into a table ,while inserting into table,i got the below error, Derived table 'Datematrix' is not updatable be
-
The new version does not work with joomla
When I am asked to upgrade my firefox version (to 3.6) I cannot do certain functions with my joomla template. Example; I cannot upload any images. I have to convert back to the 3.5.9 version in order to do this task. I need help. I want the upgrade,
-
hello Friends Is it possible to import a table from a 10gr2 database into a 9i DB? both MS Windows 2003 server. I tryed everything but just got erros. - I exported from a 9i client and imported through a 9i client. IMP-00010: IMP-00000: - From a 10g
-
Anything will help. Thanks
-
Authorization group,function group
friends while creating a table maintenance view it's asking authorization group and function group ,what are those things and what to provide there.plesae tell me in detail.