Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Maxon Cinema 4D Keyframe a property’s speed over time

  • Keyframe a property’s speed over time

    Posted by Jared Flynn on September 19, 2014 at 9:04 pm

    Hello folks!

    I come bearing an Xpresso question. I need to finely control the speed of an object’s rotation in my scene. Basically my goal is to have a User Data property called something like “Rotation Speed,” such that a value of 0 means the object isn’t moving, and increasing values result in a faster rotation. That way, I’ll be able to animate the acceleration and deceleration of my object, while ensuring that its speed remains constant in between.

    In After Effects I’ve been using the following expression in a Rotation property (along with a Slider control) to achieve this:

    sp = thisComp.layer("myRotationControlLayer").effect("Rotation Speed")("Slider");

    fr = timeToFrames( time );
    rot = value;
    for ( i = 0; i < fr ; i ++){
    t = framesToTime(i);
    rot += sp.valueAtTime( t ) * thisComp.frameDuration;
    }

    rot

    I’m fairly comfortable in Xpresso but I just can’t seem to crack into this one. I’ve tried tapping into my object’s “Previous Rotation” port in order to iterate its value from one frame to the next– this seems to do the trick in theory but in practice it’s buggy as hell since the Previous Rotation value doesn’t reset to its original state when I reset my playhead to frame 0. Here’s the setup I’m currently working with:

    I really appreciate any advice y’all may have. Cheers!

    Jared Flynn
    Motion Designer

    Supermicro SuperWorkstation 7047A-T
    Dual 8-core Xeon E5-2670 @ 2.6GHz
    64GB DDR3-1600 ECC/REG RAM
    PNY nVidia Quadro 4000
    Windows 7 Pro 64bit SP1

    Jared Flynn replied 11 years, 7 months ago 2 Members · 4 Replies
  • 4 Replies
  • Brian Jones

    September 20, 2014 at 4:13 am

    from what I’m reading this is what you are looking for – slider makes rotation faster or slower (in degrees per frame) – it resets to 0º at frame zero (I assume you have a desired ‘start point’) if it loops or if you reset the playhead. Degree node is used as all rotations in xpresso are in radians so it translates the degrees from the slider to radians.
    It? or not it?

    8004_sliderrotspeedwithresetframezero.c4d.zip

  • Jared Flynn

    September 22, 2014 at 2:32 pm

    Hi there Brian,

    This is exactly it! Thanks very much for posting this for me. So am I following correctly that the Time > Compare > Condition chain helps the rig reset to its original state? The rest of the setup is pretty similar to where I’d arrived originally, but of course yours actually works. 🙂

    Thanks so much once again for taking the time!

    Jared Flynn
    Motion Designer

    Supermicro SuperWorkstation 7047A-T
    Dual 8-core Xeon E5-2670 @ 2.6GHz
    64GB DDR3-1600 ECC/REG RAM
    PNY nVidia Quadro 4000
    Windows 7 Pro 64bit SP1

  • Brian Jones

    September 22, 2014 at 3:25 pm

    yeah the Compare receives the frame number and, if it’s equal to zero, sends a boolean true (1) to the Condition node ‘Switch’ port. The Condition node then outputs a choice of whatever comes in from the left. It does the first port if it receives a ‘0’ and the second one if it receives a ‘1’ – so on frame 0 it resets to zero (because that’s what’s in the second spot inside the node – for clarity some people like to use a constant node feeding in so they can see what’s going in rather than having to click on the node to see what value is in a non-connected port) and on all other frames it uses the first input and so the cog spins.

  • Jared Flynn

    September 23, 2014 at 1:01 pm

    Awesome, thanks so much for the insights! This really saved my bacon. 🙂

    Cheers,

    Jared Flynn
    Motion Designer

    Supermicro SuperWorkstation 7047A-T
    Dual 8-core Xeon E5-2670 @ 2.6GHz
    64GB DDR3-1600 ECC/REG RAM
    PNY nVidia Quadro 4000
    Windows 7 Pro 64bit SP1

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