• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

random couleur expression

New Here ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

Bonjour,

 

j'ai utilisé une expression pour un random color sur des couleurs de pixel avec un color control mais cela me créer des transitions entre les couleur. Je souhaite avoir les bonnes couleurs directement les unes après les autres sans passé par un dégradé.

 

Quelqu'un sait comment faire ?

 

Merci 🙂

TOPICS
Expressions , Freeze or hang , Scripting

Views

501

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 23, 2022 Nov 23, 2022

There are a number of possibilities. This one would randomly select from a list of colors every 0.5 seconds:

colors = [[1,.5,0,1],[1,1,0,1],[1,0,0,1],[.5,0,1,1],[1,0,1,1]]; // orange, yellow, red, purple, magenta
dur = .5; // duration of each color (seconds)

seed = Math.floor((time - inPoint)/dur);
seedRandom(seed,true);
colors[Math.floor(random(colors.length))]

and this one just selects a random color every 0.5 seconds:

dur = .5; // duration of each color (seconds)
seed = Math.floor((time - in
...

Votes

Translate

Translate
Community Expert ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

Can you post the expression you've used?  And maybe a screenshot of the current result and a mockup of the result you're trying to achieve?  I think that would help us answer your question.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

Without knowing what expression you used we cannot tell you much. Simply sounds like you are using a "dumb" random function that doesn't quantize the colors or picks them from an array. Of course then there's always the chance the function will just pick undesirable inbetween colors. Anyway, provide the code and explain what you exactly need.

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

There are a number of possibilities. This one would randomly select from a list of colors every 0.5 seconds:

colors = [[1,.5,0,1],[1,1,0,1],[1,0,0,1],[.5,0,1,1],[1,0,1,1]]; // orange, yellow, red, purple, magenta
dur = .5; // duration of each color (seconds)

seed = Math.floor((time - inPoint)/dur);
seedRandom(seed,true);
colors[Math.floor(random(colors.length))]

and this one just selects a random color every 0.5 seconds:

dur = .5; // duration of each color (seconds)
seed = Math.floor((time - inPoint)/dur);
seedRandom(seed,true);
random([0,0,0,1],[1,1,1,1])

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

LATEST

thank you ! exactly what i want !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines