Forum Replies Created

Page 76 of 1081
  • Dan Ebberts

    September 25, 2022 at 12:40 am in reply to: Disabled number used Dropdown

    Hard to say exactly, without seeing the details, but here goes. The biggest issue is that all 44 non-winning balls have to have access to the same random information, which is tough to do with expressions.

    I would create a text layer expression that sets up an array of the numbers 1-49, but does not include any of the winning numbers. Then I’d randomly shuffle the resulting 44-element array and publish the result as the text of that text layer. The 44 non-winning balls would then retrieve the text array and decode their random number from it. Hard to be more specific without more info, but definitely do-able.

  • Dan Ebberts

    September 24, 2022 at 4:39 pm in reply to: Disabled number used Dropdown

    OK. So trying to imagine what you’re trying to do, here’s simple example of two interacting dropdown menus on a layer named “Control”. The first is named “Transparency” and it controls a layer’s visibility, based on whether the layer’s index matches the current selection in the dropdown menu. However, the effect of the Transparency can be overridden by the “Disable” dropdown menu if Disable is set to its first entry (“On” in this example).

    T = thisComp.layer("Control").effect("Transparency")("Menu");
    D = thisComp.layer("Control").effect("Disable")("Menu");
    if (D != 1){
    T == index ? 100 : 0
    }else
    value
  • Dan Ebberts

    September 23, 2022 at 11:12 pm in reply to: Disabled number used Dropdown

    It would help to know more about how you have things set up now, and how you want the new dropdown to alter the behavior.

  • Dan Ebberts

    September 23, 2022 at 4:45 pm in reply to: Most efficient way of injecting line breaks

    Like this:

    v = "\r";
    value.replace(/.{1}/g, '$&' + v)

    Any good JavaScript + Regular Expression reference should do.

  • Dan Ebberts

    September 23, 2022 at 2:20 pm in reply to: Most efficient way of injecting line breaks

    Like this maybe:

    value.replace(/.{1}/g, '$&\r')
  • Dan Ebberts

    September 21, 2022 at 5:16 am in reply to: Collision detection on Shapes

    I think this gets pretty close. If the center of the square gets inside a circle, it should pick up that circle’s color, otherwise black. To make it work if any part of the square touches the circle would take a bunch more code. You might also need to decide what to do if the center of the square is inside both circles. But it’s an encouraging start, I think.

    C1 = thisComp.layer("RADIAL EFFECTOR 01");
    C2 = thisComp.layer("RADIAL EFFECTOR 02");
    r1 = C1.sourceRectAtTime(time,false);
    radius1 = r1.width/2;
    p1 = C1.toComp([r1.left+r1.width/2,r1.top+r1.height/2]);
    r2 = C2.sourceRectAtTime(time,false);
    radius2 = r2.width/2;
    p2 = C2.toComp([r2.left+r2.width/2,r2.top+r2.height/2]);
    myPos = thisProperty.propertyGroup(3)("Transform")("Position").value;
    d1 = length(toComp(myPos),p1);
    d2 = length(toComp(myPos),p2);
    if (d1<radius1)
    C1("Contents")("Ellipse 1")("Contents")("Fill 1")("Color")
    else if (d2 < radius2)
    C2("Contents")("Ellipse 1")("Contents")("Fill 1")("Color")
    else
    [0,0,0,1]
  • Dan Ebberts

    September 21, 2022 at 4:35 am in reply to: Collision detection on Shapes

    Hmmm…. You might have a fighting chance if each of your squares was a separate layer. Then you could use sourceRectAtTime() to get the bounding box of the square and use the bounding box of each circle to calculate its center and radius and then calculate if there’s a collision. I don’t think you have the right tools to do it with individual shapes in the same shape layer.

    Scratch all that… you do have size and location of each square, and that may be enough. I’ll be back…

  • Dan Ebberts

    September 20, 2022 at 6:39 pm in reply to: 2nd part of conditional statement not working

    Maybe like this:

    p=transform.position;
    t1 = p.key(1).time;
    t2 = p.key(2).time;
    linear(time,t1,t2,value,0)
  • Dan Ebberts

    September 20, 2022 at 4:30 pm in reply to: 2nd part of conditional statement not working

    A couple of things–you seem to be mixing the use of markers and position keyframes–you didn’t mention that in your description, and it’s not clear how that should work. Also, you don’t account for the condition where n is exactly 2, so that could be a problem.

  • Dan Ebberts

    September 20, 2022 at 12:17 am in reply to: Expression to change layer color when hit edge of comp

    How are you generating the motion? Your expression is going to have to calculate when the logo last hit an edge and use that time as a random seed so that the color will remain the same until the next collision.

Page 76 of 1081

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