利用Tweener製作動畫 – 貝茲曲線

在看過前面一篇Tweener基礎篇之後,應該會發現我們的動畫元件雖然可以依照不同的模式移動,但是在路徑上還依然是保持直線移動,而這一篇文章就要來示範如何讓元件利用貝茲曲線來產生移動路徑,至於甚麼是貝茲曲線?大家可以參考維基百科上面的說明,這邊就不贅述了。

在Tweener的官方網站裡有提供一個貝茲曲線產生器的Flash動畫讓大家下載,不過由於官方示範這個貝茲曲線產生器所使用的是舊版本的Tweener Class,所以在程式碼範例上有些缺失,馬老師這邊提供我修改過且進行中文化後的範例供大家下載

Tweener 貝茲曲線產生器 螢幕截圖

範例中Add Bezier Point是增加節點,Remove Point是刪除節點,利用這些功能並拖曳上面的範例曲線,就可以製作出你想要移動的路徑,接下來請先把「需要先被匯入與執行的Tweener」三行指令放置在程式碼的最前面,接著再把「Tweener動畫指令」貼上即可!這樣一來以後連製作這樣的路徑也會變得很方便了!

整個動畫的程式碼如下,也提供利用此效果製作的動畫檔給大家參考:

import caurina.transitions.Tweener
import caurina.transitions.properties.CurveModifiers
CurveModifiers.init()

Tweener.addTween(ball, {x:475, y:80, _bezier:[{x:150, y:43}, {x:71, y:206.5}], time:1, transition:"linear"});

希望這個範例對大家有所幫助,如果還有疑問,也可以在這邊回應唷~

You may also like...

10,045 Responses

  1. Barrybib表示:

    buy Viagra over the counter: buy viagra online – buy Viagra over the counter

  2. RogerFaf表示:

    http://maxpillsformen.com/# Cialis 20mg price in USA

  3. Charlesbot表示:

    http://fastpillsformen.com/# Cheap generic Viagra online

  4. BrettTIT表示:

    Viagra online price: FastPillsForMen – Cheap generic Viagra online

  5. Catcvq表示:

    In the modern world, we increasingly have to deal with exactly such situations, I absolutely agree with the author https://000-google-09.s3.eu-north-1.amazonaws.com/id-10.html
    Like 346

  6. Davidrox表示:

    Финансовые трудности? Решите их за минуты быстро деньги оформить займ на карту с моментальным переводом на карту. Оформление онлайн, простые условия и никакого лишнего стресса. Ваш надежный финансовый помощник!

  7. RogerFaf表示:

    https://maxpillsformen.com/# Cialis over the counter

  8. An outstanding share! I’ve just forwarded this onto a friend who had been doing a little research on this. And he in fact ordered me dinner because I found it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanx for spending the time to talk about this matter here on your blog.

  9. Barrybib表示:

    Buy Tadalafil 20mg: Max Pills For Men – Cialis 20mg price

  10. I’ve been surfing online greater than 3 hours these days, yet I never
    discovered any fascinating article like yours.
    It’s lovely price sufficient for me. In my opinion, if all site owners and bloggers made excellent
    content as you probably did, the internet will likely be
    much more useful than ever before.

    Also visit my website: gluco 6 blood gluco6 reviews

  11. Charlesbot表示:

    https://fastpillseasy.com/# buy ed pills

  12. Davidjeami表示:

    Нужны деньги срочно займ до зарплаты кредит экспресс – ваш быстрый выход! Подайте заявку из любого места, получите деньги в течение нескольких минут. Удобно, прозрачно, без скрытых комиссий.

  13. Lordtwc表示:

    Very accurately noted all the main problems that modern society faces https://000-google-09.s3.eu-north-1.amazonaws.com/id-10.html
    Like 518

  14. BrettTIT表示:

    Viagra online price: cheap viagra – Viagra online price

  15. Spot on with this write-up, I seriously believe this site needs a great deal more attention. I’ll probably be returning to read more, thanks for the info!

  16. This post is highly enlightening. I genuinely enjoyed perusing it. The content is highly structured and simple to comprehend.

  17. вызов нарколога на дом частная скорая помощь вызов нарколога на дом частная скорая помощь .

  18. RogerFaf表示:

    http://fastpillsformen.com/# buy viagra here

  19. Josephvuple表示:

    Строительный портал https://bastet.com.ua ваш путеводитель в мире стройки! Подборка лучших материалов, контакты мастеров, проекты и лайфхаки. Создавайте уют и красоту с нашим сервисом!

  20. срочная наркологическая помощь в москве [url=www.taksafonchik.borda.ru/?1-2-0-00001312-000-0-0-1730876668/]срочная наркологическая помощь в москве[/url] .

  21. наркологическая скорая в москве [url=http://www.rolandus.org/forum/viewtopic.php?p=106508/]наркологическая скорая в москве[/url] .

  22. In June of that yr, it was introduced PG could be buying a majority share within the Portuguese biotech agency, FairJourney Biologics.

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。