Randomly choose color for shape

I am working on a project for fun in which I need to have 144 squares choose a random color out of a pool (array) of predetermined colors and I need these shapes to do so every 1 second in the project. I was thinking the only way would be to write an after effects script, but I also thought it'll be cool if I could per object place a script which I do not know if it's possible.
The only thing I am familiar with in after effects is creating time lapse. I have not played with it much more than that, however I am familiar with coding and have written some advanced scripts for Photoshop.
Any help in pointing me into the right direction will be appreciated.
Thanks

So, played around with what you mentioned, and nether of them will do what I needed. I ended up playing with scripting and finally finished getting what I wanted.
#target aftereffects
var colors = [[1,0.95294117647059,0.4,1],[1,1,0.6,1],[1,0.91764705882353,0.21960784313725,1],[1,1,0.054901960784314,1],[1,0.96470588235294,0.36470588235294,1],[1,0.8156862745098,0.26274509803922,1],[1,0.92156862745098,0.26274509803922,1],[1,0.88235294117647,0.26274509803922,1],[1,0.90980392156863,0.43529411764706,1],[1,0.97254901960784,0.49803921568627,1]];
app.beginUndoGroup("Color Change");
var comp1 = app.project.item(1); //Comp 1
var duration = comp1.workAreaDuration;
var squares = comp1.layer(2).property("ADBE Root Vectors Group"); //Squares
for (var i=1; i<=squares.numProperties; i++) {
    var square = squares.property(i);
    var fillColor = square.property("ADBE Vectors Group").property("ADBE Vector Graphic - Fill").property("ADBE Vector Fill Color");
    while (fillColor.numKeys!=0) {
        fillColor.removeKey(1);
    var previousColor = 0;
    for (var t=0; t<duration; t+=0.5) {
        var choosenColor  = 0;
        while (true) {
            var choosenColor = Math.floor(Math.random()*colors.length);
            if (t==0 || choosenColor!=previousColor) {
                break;
        previousColor = choosenColor;
        var color = colors[choosenColor];
        fillColor.setValueAtTime(t, color);
    for (var k=1; k<=fillColor.numKeys; k++) {
        fillColor.setInterpolationTypeAtKey(k, KeyframeInterpolationType.HOLD, KeyframeInterpolationType.HOLD);
app.endUndoGroup();

Similar Messages

  • Random Line Colors? noob needs helppppp :(((

    How do you make a program with random line colors heres my program:
    import java.awt.*;
    import java.applet.*;
    import java.util.*;
    import java.util.Random;
    public class Lab6 extends Applet
         public void paint(Graphics g)      
              g.drawLine(0,300,800,300);
              g.drawLine(400,0,400,600);
              Random rand = new Random(12345);
              for(int x=0;x<=100;x=x+1)
              g.drawLine(rand.nextInt(400),rand.nextInt(300),rand.nextInt(400),rand.nextInt(300));
    rand.setSeed(12345);
              for(int x=0;x<=100;x=x+1)
              g.drawLine((rand.nextInt(400) + 400),rand.nextInt(300),(rand.nextInt(400) + 400),rand.nextInt(300));
    i need to make random line colors for the second loop and i dont get how. i can only set the lines for the second loop to one color. please help! i'm a real noob. =(

    This gets the color with a hex integer. You can use
    new Color(seed.nextInt(256), ...
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Random;
    public class Lab6 extends Applet
        Random rand = new Random(12345);
        Random seed = new Random();
        public void paint(Graphics g)
            super.paint(g);
            g.drawLine(0,300,800,300);
            g.drawLine(400,0,400,600);
            for(int x=0;x<=100;x=x+1)
                g.drawLine(rand.nextInt(400),rand.nextInt(300),
                           rand.nextInt(400),rand.nextInt(300));
            rand.setSeed(12345);
            for(int x=0;x<=100;x=x+1)
                g.setColor(getColor());
                g.drawLine((rand.nextInt(400) + 400),rand.nextInt(300),
                           (rand.nextInt(400) + 400),rand.nextInt(300));
        private Color getColor()
            return new Color(seed.nextInt(0xffffff));
        static WindowListener closer = new WindowAdapter()
            public void windowClosing(WindowEvent e)
                System.exit(0);
        public static void main(String[] args)
            Applet applet = new Lab6();
            Frame f = new Frame();
            f.addWindowListener(closer);
            f.add(applet);
            f.setSize(800,600);
            f.setLocation(50,50);
            applet.init();
            f.setVisible(true);
    }

  • Can I set default colors for generated shapes in Premiere Pro CC?

    I'm working on some highlight video where I need to generate an ellipse on each clip to highlight a player. I'd like to use a yellow/yellow, 20% softness, 8 thickness ellipse each time, but by default PP gives me an ugly green/blue combination, and I have to change the inside/outside colors, softness and thickness each time I add a clip and generate an ellipse.
    Is there a way to set a default inner/outer color, thickness, and softness setting for each new generated shape so that I don't have to keep repeating these steps?

    If you are using the Title Designer to generate your ellipse, and if I understand what you want, the answer is yes.
    Unless I am completely off-base, your default font style below the title has the colors of that ugly green/blue combo.
    You can easily just set the ellipse the exact way you want it, and then go into the Font Styles menu and create a new font style. Give it a unique name like "Ellipse" and then drag that new style from the end up to the beginning of the list. (Upper left hand corner).
    I created an ellipse using a greenish yellow, rather unattractive color for both the shape and the stroke. I used a higher opacity because it shows up better in the screen shot, but I could have set it for 20% easily enough. I then went to the styles menu, created a new style, gave it a name, then went to the last style and dragged it up to the top left where you see it now. You have to look close.
    It is not particularly obvious that the shapes are based on the font style just as much as the text is.

  • Changing default color for arrows from the Shapes palette.

    I'm building a tutorial website for how to buy kitchens from my cabinetshop.
    I use a lot of arrow type lines from the Shapes Palette.
    After I create the arrow-line I have to re-color it to red with the Graphics Inspector.
    Is there a way to set red as the default color for this object?

    No. Send a feature request to Apple via http://www.apple.com/feedback/iweb.html.
    OT

  • Choose accent color for hovered icons when using dark interface in Bridge?

    How about add the ability to choose the accent color for hovered icons when using a dark interface in Bridge?  Currently, the icon color remains orange and unchangeable.  Personally, I would prefer a blue accent color to match my system.  Any chance of making this possible in CS6?

    Oh, I should add that I'm looking for solutions somewhat up-to-date and/or are related to or designed for 10.6 Snow Leonard. I did a search for answers before asking the question, and the (mostly unsatisfactory) answers I found were all from several years ago and applied to earlier versions of OSX (10.3, 10.4, etc.), and therefore no longer were relevant or usable.

  • How can I change the default fill and stroke colors for new shapes?

    As you can see in the following screen recording, after I change the stroke and fill color, all my subsequent rectangles are created respecting these new colors. But then when I delete all the rectangles, choose the rectangle shape tool once again, and start creating new rectangles, they start getting created with another color I had used some time ago (and I don't know how did it become the default color).
    http://tinypic.com/r/64jrwp/6
    So how can I change the defaults, so that the fill color is say #ddd, and the shape has no stroke at all?
    Thanks.

    When you have the shape tool selected you will see in the tool bar below - file edit etc a fill and stroke. This is where you can change the colours.
    You can keep drawing your shapes like you did in the video but then select the rectangle and change the colour from this tool bar. The reason it changes will be because you changed the colours you were using (foreground / background) that display in the left side tool bar.

  • Choose desired color for canvas

    Dear all,
    i am using oracle developer suite 10g for windows plateform.
    i want to use a specific colour for my canvas which is on my desktop.
    i capture the desktop, and open it in mspaint, and pick that color and add it to custom color.
    now i am wondor how to select it as a background color for the canvas.
    any idea?
    Regards.

    Maahjoor wrote:
    i am pretty sure that it was not a registery technique.
    it was purely oracle forms technique.Yes !!!
    you can.
    follow the instruction.
    In 10g
    Set to Editable
    Edit -> Preferences -> change colour mode property to Editable -> Exit form builder
    Add Custom Colour
    Re-open the form
    Open a canvas
    From Edit Menu-> Layout Options -> Colour Palette
    Select a colour to edit by clicking on an undefined colour i.e. a white square on the bottom far left of the palette
    In the current colour dialog it will say something like custom5 change it to a more meaningful name you can call it the rgb value
    Then click on rename -> then Edit -> change the rbg value to the colour you want to add-> click OK
    Export the custom colour palette
    From the canvas -> Edit -> Export -> Colour Palette -> give it a name
    Your are done...
    Hamid

  • Fixing legend color for charts

    Is it possible to fix legend color in charts ? For e.g. I want
    lengend A to have "COLOR1"
    legend B to have "color2" etc
    It looks like CR chooses color in random order. I need to fix the color displayed for consistency. Please help me.
    Pradeep

    Hi
    - use condition for defining colors in your chart.
    - Create a mock legend using text boxes.
    Hope this helps!!!
    Regards
    Sourashree

  • Can you no longer have a background color for the text box in the new version of hp photo creations

    just updated to the new version of HP Photo Creations, used to be able to have a colored background for the text box - is that no longer possible in this new (not better) version????!!!!! Uuuuuuuuuugh

    Hi Lainey.
    Thanks for asking. We're working on bringing back that feature. In the meantime, here's another way to add text backgrounds: Add a placeable graphic and then click the Arrange button to send it to the back, behind the text.
    That approach also gives you more interesting shapes. The new alignment guides make it a snap to align a graphic with a text box. In the example below (it may take a day for the image to show up here), I also used the new Premium Editing Features to change the color of the graphic.
    P.S. — Applying a thick border to an empty text box (also using the Premium Editing Features) is another way to create a background shape. That has the advantage of letting you pick any color for the box. You'll also find several new text styles at the bottom of the new text menu.
    Let us know if we can help further,
    RocketLife 
    RocketLife, developer of HP Photo Creations
    » Visit the HP Photo Creations Facebook page — news, tips, and inspiration
    » See the HP Photo Creations video tours — cool tips in under 2 minutes
    » Contact Customer Support — get answers from the experts

  • Problem in Setting Background Color for JButton

    Hi,
    I am using Background color for JButton (color is selected from the customized JColorChooser created by us) where it contains the option of transparency. If we choose light color, then the background is set to JButton, but when we mouse-over the JButton, other components inside the container (JPanel) is getting displayed inside the button.
    Can anyone help to sort out this problem.
    Thanks in advance.

    Hi,
    Here is the code.
    DialogWrapper is JDialog and ColorEditorPane is JPanel.
    DialogWrapper     dlg         = new DialogWrapper();
    ColorEditorPane colorPanel = new ColorEditorPane();
    colorPanel.setValue( _data.getTransparentColor());
    dlg.showWrappedDialog( colorPanel, "color_help", "color_dialog" );
    if( dlg.isOK())
    Color chosenColor = (Color) colorPanel.getValue().getContent();
    _data.setTransparentColor( chosenColor );
    _transparentColorDisplay.setBackground( chosenColor );
    _transparentColorDisplay.setOpaque( true );
    this.repaint();
    this.doLayout();
    this.validate();
    }I've several components like JCheckBox, JRadioButton, JTextField in "this".

  • How can I get Colorful Tabs to use separate colors for 2 different gmail accounts?

    Running Firefox 29.0.1 on iMac OSX 10.9.3. I have multiple Google accounts: 2 gmail accounts and 1 Google Calendar. The Add-on Colorful Tabs will allow me to choose a color for one gmail account , but it also uses that same color for the other gmail account. How can I get different colors on 2 different gmail accounts?
    Also, Colorful Tabs is also doing the same thing for my homepage (google.com) and my google calendar. How can I get different colors on these 2?

    I personally use "Fabtabs" for my mozilla FireFox.
    https://addons.mozilla.org/en-US/firefox/addon/fabtabs/
    This add-on doesn't have any issues like that when I use it.

  • How to get similar color for objects in different pictures

    how do you get similar color for objects in different pictures
    I have a prodject that i'm working on and i need to edit several images at once (preferabley) so that they are the same color. They are wooden cupboards and i need all the wood looking the same colour. In light room you can edit a group of images at the same time hence the colours are the same . Is this possible in Elements ? If so how do i do this ?
    I have tried duplicating layers and it just replaces the whole image, it seems to work using levels layers but not the other layers ... I have 30 more images to do and would ideally not like to adjust all the images manually ? I dont mind doing minor tweaks. Essentially all the images where taken with the same camera and lighting and lens's ...
    Screen shot is where I'm at at the moment...
    I have posted this question else where but was told to repost  - this is a link to my previous post as to where we got to
    http://forums.adobe.com/message/4720576#4720576

    You could try using the raw converter. Open one file and edit it (File>Open, pick the image and choose Camera Raw as the format before you click Open). Then open the next image and click the little four-lined square on the upper right side of the ACR window and choose Previous Conversion from the flyout menu.

  • My HP Officejet Pro 8600 is randomly printing coloring sheets most often during the night!

    For about a month, my HP Officejet Pro 8600 is randomly printing coloring sheets, valentines, etc.  Usually this is happening at night!  The pages use a lot of ink!  How can I get this to stop?  Is this part of HP's eprint?? Help!

    Hi there, check out this thread for information on how to cancel scheduled print apps.
    Best. 
    If my reply helped you, feel free to click on the Kudos button (hover over the "thumbs up").
    If my reply solved your problem please click on the Accepted Solution button so other Forum users may benefit from viewing the post.
    I am an HP employee.

  • Sending from FCPS to Color doesn't work (choosing Color is not possible)

    Hi, i bought the final cut studio 3 update for my final cut 4.5 HD application and installed the full 47GB update and i ran all possible software updates. i even reinstalled my mac os 10.5.6 befor installing fcp. if i right click the footage in final cut pro for sending it to color 1.5 i can't choose alternative for sending it to color. sending the footage to compressor, motion or soundtrack works properly. i've never used colors befor, so... do i have to preset something in the settings? additionaly, i made a online registration for color, not for fcp. thanks for helping.
    Message was edited by: Snydelchen

    Hi, i bought the final cut studio 3 update for my final cut 4.5 HD application and installed the full 47GB update and i ran all possible software updates. i even reinstalled my mac os 10.5.6 befor installing fcp. if i right click the footage in final cut pro for sending it to color 1.5 i can't choose alternative for sending it to color. sending the footage to compressor, motion or soundtrack works properly. i've never used colors befor, so... do i have to preset something in the settings? additionaly, i made a online registration for color, not for fcp. thanks for helping.
    Message was edited by: Snydelchen

  • Background Colors for Titles

    Is there a setting within iMovie that will provide for a different color background than black for titles?
    Thanks!

    Placing a title over a color background
    1 In the timeline viewer, select the video clip to the right of where you want to add a title or text
    and drag the clip to the right to create a gap.
    2 Click the clip viewer button and locate the new color clip (it will be black).
    3 Select the color clip and choose File > Show Info.
    4 Click the Color box (shown below) and choose a color for the clip.
    5 Click Select and close the Color box.
    6 Follow the instructions above for creating a title, but don’t choose the Over Black checkbox. A
    color clip is technically a video clip.
    Sue

Maybe you are looking for

  • IMovie 10.0.6 - Launch failing - Yosemite

    Had no troubles with it, updated to 10.0.6, still worked fine for days. Yesterday it had "quit unexpectedly" and wouldn't launch anymore after with such error as below. Clearing Application cache did not help. Also removing the library (so that it ca

  • Ipod touch first generation home button

    hello, i have an ipod touch first generation and i have the problem that the home button got stucked for no reason, it looks like it is constantly pressed. i know that the model is completely obsolete and that it would be better to buy a knew one, bu

  • Adobe Photoshop 7.0 and Snow Leopord

    Does anyone know if Adobe Photoshop 7.0 will work with Snow Leopord?

  • Error in event simulation

    Hi..   I've configured the workflow for FI Document Parking/Posting (for the BO FIPP). I'm using the standard WF WS10000051(having no customization) and its sub workflows. But when I perform an event simulation for FIPP CREATED in SWU0, I'm getting t

  • Link directly to document?

    Is there standrad portal solution to allow an external application and/or browser to go directly to a Document Info Record? For example, I have an external appliation that knows the pertinent DIR information and would like to direct a user directly t