9
$\begingroup$

enter image description here

Hello, I would like to be able to grow the curve shown in the gif above at a constant velocity. For the straight edges of the curve, I just don't like how they grow super quickly. It looks a bit too choppy.

I assume that the curve growth velocity is dependent upon the density of the curve's vertices. There are fewer vertices throughout these straight edges, therefore the curve will grow faster along those edges. I think an even distribution of vertices throughout the curve with small distances between them to maintain detail could possibly solve this, but I don't know how to do that.

To create the animation, I started off with my mesh symbol. I converted it to a curve, added a nurbs path and scaled it down, set the curve's bevel object as the small nurbs path, set the curve type to 2D, unchecked the curve's cyclic-u property, and then keyframed the end value from 0 to 1 under start & end mapping to animate the growth. I also added a few vertices to the curve to patch the slit caused by unchecking cyclic - U.

I found that animating the curve using this method had the best topology on the symbols I'm creating these curves out of. I would prefer to maintain the sharp corners of the symbol if possible.

EDIT: So, to remove slanted tips caused by changing the mapping end & start to spline, I end up having to subdivide the long segments of the curve. I wrote a script that does this if anyone else out there needs it. The pseudocode is as follows: "for each of the curve's segments, if the segment length is greater than some amount, subdivide that segment with some number of cuts"

import bpy

curve = bpy.context.scene.objects["Latex Figure"]

matrix = curve.matrix_world 

bpy.context.view_layer.objects.active = curve

bpy.ops.object.mode_set(mode = 'EDIT')

i = 0
range = len(curve.data.splines.active.points)
while i < range:
    point0 = curve.data.splines.active.points[i].co
    point0 = matrix @ point0

    if i == range - 1:
        point1 = curve.data.splines.active.points[0].co
    else:
        point1 = curve.data.splines.active.points[i + 1].co
        
    point1 = matrix @ point1
         
    d = (point1 - point0).magnitude
    
    someAmount = .1
    
    numCuts = int(2 * d/someAmount)
    
    if d > someAmount:
            
        bpy.ops.curve.select_all(action='DESELECT')
        
        curve.data.splines.active.points[i].select = True
        if k == r - 1:
            curve.data.splines.active.points[0].select = True
        else: 
            curve.data.splines.active.points[k + 1].select = True
      
        bpy.ops.curve.subdivide(number_cuts = numCuts)
        
        i += numCuts + 1
        range += numCuts
         
    else:
        i += 1
        
        
bpy.ops.object.mode_set(mode = 'OBJECT')        

$\endgroup$
2
  • 2
    $\begingroup$ I think you are correct about the even spacing of points. To add more, select 2 points, right click and select "subdivide". You can change the number of subdivisions (points added) by using the Operator Panel box that pops up in the bottom left after you subdivide once. $\endgroup$ Commented Oct 31, 2021 at 3:15
  • $\begingroup$ @ChristopherBenett Alright thanks. I was worried that appending these new vertices via subdividing would mess up the order of the curve path growth because the numeric order of the vertex indices became scattered. Thankfully, the curve grows along the same path. I'm gonna write a script that does subdivisions between neighbor vertices if the distance between the two is greater than some amount. $\endgroup$ Commented Oct 31, 2021 at 3:37

2 Answers 2

9
$\begingroup$

If you set the 'Mapping' Start / End to 'Spline' on a Bezier curve..

enter image description here

.. then the curve's length is mapped from 0-1. (Or, at least, a reasonably sampled approximation of it). You can put linearly-interpolated key-frames on those fields.

enter image description here

BTW.. if you want a round profile, you can use the native bevel. You may not need a separate bevel object.

In your particular case, the object-level scale of your curve is way out of whack, at 600. CtrlA > applying scale brings it to 1, but then you have to correct the radius to compensate. Here, I've brought the radius of the control-points to 0.1 (in the N panel, in Edit Mode). When that's done, you don't have to convert the curve type. It works as a NURBS.

The front of the sweep is diagonal along some of the straight sections. It's interpolating between the directions of the control points at the end of the segments. Inserting a couple more control points entirely in the straight, towards the ends of the segments, will fix that, if you need to.

$\endgroup$
5
  • $\begingroup$ Hey, so I selected my curve, changed its bevel from object to round, gave it a small depth, and then changed the start and end mapping to spline. It ended up warping the "+" symbol into what looks like a star. imgur.com/a/KEncoRo $\endgroup$ Commented Oct 31, 2021 at 19:06
  • $\begingroup$ @Adam717 See edit. $\endgroup$
    – Robin Betts
    Commented Nov 1, 2021 at 9:38
  • $\begingroup$ Nice. I have the curve animating at a constant velocity now. I do see the diagonal front sweep. I would like to correct it if possible. I'm having a hard time interpreting what you mean by "entirely in the straight, towards the ends of the segments" $\endgroup$ Commented Nov 1, 2021 at 19:36
  • $\begingroup$ Hi, @Adam717 Subdivide the long straight segments, GX or GY the new points so they are near the curves at the ends. Then the interpolation should be between those points, which are straight up-down, or straight left-right. (I hope) :) $\endgroup$
    – Robin Betts
    Commented Nov 1, 2021 at 19:53
  • 1
    $\begingroup$ Ok, I see what you mean now. $\endgroup$ Commented Nov 1, 2021 at 20:03
7
$\begingroup$

With animation nodes you can easily turn the curve in a curve with equal distance vertices like this:

enter image description here

if you extend the animation nodes setup like this, you got constant speed:

enter image description here

enter image description here

by adding a map range node you can get increasing speed:

enter image description here

enter image description here

Note: with a little math you can exchange the map node with some math nodes and you can make the velocity more configurable...

$\endgroup$
2
  • $\begingroup$ Hello. So I tried out this method. I ran into a few issues. The first thing I noticed after turning the curve into an equidistant curve was that the corners which were once sharp are now rounded. I apologize for not mentioning that I wanted to keep the sharp corners. That's my fault. The other issue that I ran into was that near sharp turns, the topology of the curve became a bit messy. imgur.com/a/ffc0bAe $\endgroup$ Commented Oct 31, 2021 at 20:05
  • 1
    $\begingroup$ Flashback to the pipes screensaver on older Windows $\endgroup$
    – BruceWayne
    Commented Oct 31, 2021 at 22:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .