Движение вдоль кривой BLine

From Synfig Studio :: Documentation
< Doc:Following a Spline
Revision as of 20:32, 20 September 2012 by Zurba11 (Talk | contribs) (Created page with "<!-- Page info --> {{Title|Движение вдоль кривой BLine}} {{Category|Tutorials}} {{Category|Tutorials Advanced}} <!-- Page info end --> == Введение ...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Languages Language: 

English • čeština • Deutsch • español • français • русский


Введение

Если вы используете версию 0.61.08 или ниже, то используйте старую версию этой статьи, эта статья актуальна для версии 0.61.09 и старше.

Эта статья о том как создать объект следующий вдоль произвольной кривой и поворачивающий при этом в сторону направления следования.

Содержание

Нам предстоит:

Создаём новый файл

Файл > New

Создаём слои

Выберите инструмент "Кривые" Bline tool.png

поставьте флажок только напротив параметра "Создать кривую контура"

нарисуйте кривую вдоль которой будет двигаться наша стрелка

нажмите кнопку "Создать кривую" в нижней части Панели Параметров Инструмента

теперь, не переключаясь с инструмента "Кривые" выберите флажки "Создать кривую контура" и "Создать кривую области" на Панели Параметров Инструмента

still in the bline tool, enable Fill and Outline checkboxes in tool options Tool Options.png

нарисуйте стрелку или что то подобное, указывающую на право

переключитесь на инструмент трансформации.

select the outline, hit control-a to select all its ducks except the green position duck

drag the ducks so that the arrow is centred around the green position duck

add a rotate layer above the outline and region

encapsulate the rotate, outline, and region layers

so now you've got 2 top-level layers: a curved path, and an encapsulation containing an arrow and a rotate layer

Make the Arrow Move and Rotate

select the encapsulation layer by clicking it in the Layers panel

select its green position duck by clicking on it in the canvas window

additionally select the Rotate layer by holding Control and clicking it in the Layers panel

additionally select the blue "rotation amount" duck by holding Control and clicking on it in the canvas window

so now we should have 2 layers selected, and one duck from each of those 2 layers selected

now additionally select the curved bline layer (it should be the last layer in the Layer panel's list) by holding Control and clicking on it

right-click on the dotted line that indicates the position of the curved bline - not on any duck, but on the dotted link between ducks

from the context menu that pops up, select "Link to BLine" Link to Bline.png

the encapsulated arrow should move so that its green position duck is on the bline, and it should rotate so that the arrow points along the bline at that point

select just the encapsulation layer, and drag its green duck around. you'll see that the duck is constrained now to lie on the bline, and that dragging it also affects the rotation of the arrow as expected

we can now animate the arrow. turn on "animate edit mode" by clicking the icon in the bottom right of the canvas window.

at time 0f, drag the encapsulation layer's green position duck to one end of the bline

at time 5s, drag the same position duck to the other end of the bline

Try File > Preview or View > Play to watch the animation.

Results

This is the animation I ended up with: Arrow-follows-bline.sifz‎

Controlling the linear velocity

By default, the arrow takes the same time to move along each segment of the bline. So if there's a long straight part then a bendy complex part, the arrow will move much faster along the straight parts (since there will be less vertices in that part). In physics terms, the linear velocity (that is, the speed over the bline) is not constant.

By enabling the homogenous parameter of Link to BLine, the velocity becomes constant, as one almost always wants. See this demo.


Languages Language: 

English • čeština • Deutsch • español • français • русский