利用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...

9,678 Responses

  1. buy admin rdp表示:

    I am lucky that I discovered this website , precisely the right info that I was searching for! .

  2. Jeraleepisn表示:

    gay dating game
    gay dating in chicago
    which senoir gay dating app has most members lakeland fl

  3. Chelsaepisn表示:

    online single sites
    dating sim
    personals dating

  4. You have some helpful ideas! Maybe I should consider doing this by myself.

  5. I loved your idea there, I tell you blogs are so exciting sometimes like looking into people’s private life’s and work. Every new remark wonderful in its own right.

  6. dance swing表示:

    If most people wrote about this subject with the eloquence that you just did, I’m sure people would do much more than just read, they act. Great stuff here. Please keep it up.

  7. We write easy to read books teaching business owners how to build websites and improve their visibility online. A lot of our readers still required additional help, so we decided to offer SEO services in Beverly Hills and the greater Los Angeles area. We have a few best selling books available on Amazon and Barnes & Noble. Our books have helped thousands of people build websites and improve their digital marketing efforts. We have over 200 positive reviews on all of our books, and now we help our readers on a one-on-one basis. We’ve put together a team to help offer SEO and digital marketing services for WordPress and HTML websites. No project is too big or too small. Contact us now to request a free SEO consultation.

  8. Gladipisn表示:

    russia gay dating profiles
    dating dominant gay men
    gay dating in kingman az

  9. keyston bros表示:

    Thanks for another great post. Where else may anybody get that type of info in such an ideal way of writing? I have a presentation next week, and I’m at the search for such information.

  10. Davinapisn表示:

    flirting dating site
    local women dates
    free free online dating

  11. Nice Post. It’s really a very good article. I noticed all your important points. Thanks.

  12. Prevent Fires表示:

    I think this is among the so much vital info for me. And i’m happy reading your article. But wanna remark on few common issues, The site style is wonderful, the articles is really excellent : D. Just right job, cheers

  13. Kaitlynnpisn表示:

    plenty of fish dating site of free dating
    mature singles
    free women

  14. I would really like to appreciate the endeavors you cash in on written this article. I’m going for the similar best product from you finding out in the foreseeable future as well. Actually your creative writing abilities has urged me to begin my very own blog now. Genuinely the blogging is distributing its wings rapidly. Your write down is often a fine illustration showing it.

  15. cooe表示:

    If you don’t mind, where do you host your weblog? I am looking for a very good web host and your webpage seams to be extremely fast and up most the time…

  16. I just couldn’t leave your web site prior to suggesting that I really enjoyed the standard info an individual supply to your guests? Is going to be again continuously in order to inspect new posts

  17. my profile表示:

    What made you first develop an interest in this topic?

  18. Berthepisn表示:

    best dating websites free
    single women darling side
    tinder dating

  19. informate表示:

    Amazing content on your website.

  20. Kyrstinpisn表示:

    gay dating simulator tumblr
    hiv gay black men dating sites
    where can a hungry gay bottom find a top dating

  21. Thanks for sharing the information. I found the information very useful. That’s a awesome story you posted. I will come back to scan some more.

  22. Joannpisn表示:

    matchmaking services melbourne
    site of dating
    free sites

  23. A wholly agreeable point of view, I think primarily based on my own experience with this that your points are well made, and your analysis on target.

  24. It is perfect time to make some plans for the future and it is time to be happy. I’ve read this post and if I could I want to suggest you some interesting things or suggestions. Perhaps you can write next articles referring to this article. I wish to read more things about it!

發佈留言

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