Forum Replies Created

  • Sander Van dijk

    July 11, 2016 at 1:10 am in reply to: Trigger a animation using a checkbox

    hallo,

    Any idea how to make this animate from frame 42 to 0 again once the trigger is switched off again?

    Thanks!

    p = thisComp.layer("On/Off Switch").effect("Checkbox Control")("Checkbox");
    if (p.value){
    gotit = false;
    t = time;
    while (t >= 0){
    if (! p.valueAtTime(t)){
    gotit = true;
    break;
    }
    t -= thisComp.frameDuration;
    }
    if (gotit) Math.min(time-t,framesToTime(42)) else 0;
    }else
    0

  • Sander Van dijk

    March 27, 2014 at 6:52 pm in reply to: Changing colours of a few circles at random

    I might know what is going on. Set the cycle slider to for example 5 to make it pick a new random color 5 times per second.
    if you don’t like the picked colors you can increase the Seed slider.

    Hope that works!

  • Sander Van dijk

    March 27, 2014 at 6:19 pm in reply to: Changing colours of a few circles at random

    Not sure why, make sure the names of the control layer and its effects are lowercase. exactly as the image shows.
    Can you share a screenshot of your setup?

    try this:

    var controlLayer = thisComp.layer(“control”);
    var mySeed = controlLayer.effect(“seed”)(“Slider”);
    var myCycle = controlLayer.effect(“cycle”)(“Slider”);
    var numEffects = controlLayer.effect(1).propertyGroup(1).numProperties;

    var activeColors = [];
    var ListValue = 0;
    var numColorsActive = 0;

    for ( var n=1; n <= numEffects; n++){
    if ( controlLayer.effect(n)(1).name == “Color” && controlLayer.effect(n).active ){
    activeColors [ ListValue ] = n;
    ListValue++;
    numColorsActive +=1;
    };
    }

    var seed = Math.floor( (time-inPoint)*myCycle )+mySeed;
    seedRandom( seed*index , true );

    generateRandom = Math.floor( random( 0,numColorsActive ) );
    var pickColor = activeColors[ generateRandom % numColorsActive ];
    controlLayer.effect( pickColor )(“Color”);

  • Sander Van dijk

    March 27, 2014 at 4:17 pm in reply to: Changing colours of a few circles at random

    Hello Bronwyn,

    1. Create a layer with the name control in your comp.
    2. Apply two sliders to the control layer, one called seed the other called cycle
    3. Then drag 5 ( or more ) color control effects on the control layer.
    4. Then copy this new code into the fill effect color

    The Fill effect will now pick a random color from the color controls available. You can also turn the color effect off to disable that particular color.

    S.

    try{
    var controlLayer = thisComp.layer(“control”);
    var mySeed = controlLayer.effect(“seed”)(“Slider”);
    var myCycle = controlLayer.effect(“cycle”)(“Slider”);
    var numEffects = controlLayer.effect(1).propertyGroup(1).numProperties;

    var activeColors = [];
    var ListValue = 0;
    var numColorsActive = 0;

    for ( var n=1; n <= numEffects; n++){
    if ( controlLayer.effect(n)(1).name == “Color” && controlLayer.effect(n).active ){
    activeColors [ ListValue ] = n;
    ListValue++;
    numColorsActive +=1;
    };
    }

    var seed = Math.floor( (time-inPoint)*myCycle )+mySeed;
    seedRandom( seed , true );

    generateRandom = Math.floor( random( 0,numColorsActive ) );
    var pickColor = activeColors[ generateRandom % numColorsActive ];
    controlLayer.effect( pickColor )(“Color”);

    }catch(err){
    value;
    };

  • Sander Van dijk

    March 26, 2014 at 3:23 am in reply to: A blinking expression that gets faster with time

    Hi Dan,

    How would you add time offset to your speed control expression? like valueAtTime(time-1) // min one sec for example
    I want to offset the keyframes of spd = effect(“Slider Control”)(“Slider”); based on the index number.
    I’ve tried adding offsets everywhere but it keeps jumping around or rotating backwards really fast…

    Cheers,
    Sander

  • Sander Van dijk

    March 25, 2014 at 3:05 pm in reply to: Changing colours of a few circles at random

    Hey Bronwyn,

    You can make your image grayscale and overlay solids with fill effects.
    Then apply this expression to the color property of that fill effect to make it change color over time.
    You can change the var cycle to say how many time per second you want to change to another random color.

    You can create sliders for all the vars so you can change the values for multiple fills.
    thisComp.layer(” control layer “).effect(“Slider Control”)(“Slider”);

    S.

    var cycle = 5; // how many times to change per second;
    var randomSeed = 2; //random seed

    seed = Math.floor(time*cycle)*randomSeed;
    seedRandom( seed , true );

    var myColor = Math.floor( random(0,255))/255;
    var mySaturation = .5
    var myLlightness = .5
    var myAlpha = 1;

    hslToRgb( [ myColor, mySaturation, myLlightness , myAlpha ] )

    var cycle = 5; // how many times to change per second;
    var randomSeed = 2; //random seed

    seed = Math.floor(time*cycle)*randomSeed;
    seedRandom( seed , true );

    var myColor = Math.floor( random(0,255))/255;
    var mySaturation = .5
    var myLlightness = .5
    var myAlpha = 1;

    hslToRgb( [ myColor, mySaturation, myLlightness , myAlpha ] )

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy