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

20,624 Responses

  1. Weldonsib表示:

    sweet bonanza yorumlar: sweet bonanza slot – sweet bonanza demo sweetbonanza1st.shop

  2. Weldonsib表示:

    slot casino siteleri: guvenilir casino siteleri – lisansl? casino siteleri casinositeleri1st.com

  3. RobertCex表示:

    slot casino siteleri: lisansl? casino siteleri – guvenilir casino siteleri casinositeleri1st.com

  4. Weldonsib表示:

    casino bahis siteleri: casibom guncel adres – vaycasino casibom1st.com

  5. EdwardNiZ表示:

    Exponent Finance is redefining DeFi lending by providing secure, transparent, and high-yield investment solutions. Through smart contract-powered lending pools, Exponent Finance DeFi platform allows users to borrow and lend crypto assets with optimal efficiency and minimal risk. Whether you’re looking to earn passive income through staking or access instant liquidity, Exponent Finance offers a decentralized, non-custodial, and user-friendly solution to meet all your financial goals in the crypto ecosystem. https://exponent.ink

  6. онлайн-казино драгон мани онлайн-казино драгон мани .

  7. DarrenVoima表示:

    Elara Finance is transforming decentralized lending by offering secure, transparent, and flexible crypto loan solutions. Built on blockchain technology, Elara Finance enables users to borrow and lend digital assets seamlessly without intermediaries. With low-interest rates, automated smart contracts, and a permissionless DeFi environment, Elara Finance is making crypto lending accessible and profitable for investors worldwide. https://elara.ink

  8. RobertCex表示:

    sweet bonanza oyna: sweet bonanza siteleri – sweet bonanza slot sweetbonanza1st.shop

  9. Weldonsib表示:

    sweet bonanza siteleri: sweet bonanza giris – sweet bonanza 1st sweetbonanza1st.shop

  10. Davidled表示:

    https://casibom1st.com/# 2025 deneme bonusu veren bahis siteleri

  11. BradyGem表示:

    tl casino: casibom guncel giris – deneme bonusu veren siteler yorumlar casibom1st.com

  12. BradyGem表示:

    orisbet: casibom – kumar siteleri casibom1st.com

  13. Chrismealp表示:

    DEQ Finance is revolutionizing decentralized trading by offering a seamless, secure, and efficient crypto exchange experience. Built with cutting-edge blockchain technology, DEQ Finance provides traders with fast transaction speeds, deep liquidity, and a transparent trading environment. Whether you’re a beginner or a professional trader, DEQ Finance delivers high-performance DeFi solutions tailored to modern trading needs. https://deq.li

  14. Kennethhab表示:

    Cytonic is revolutionizing blockchain security with advanced cybersecurity solutions tailored for Web3 applications. By integrating decentralized encryption, AI-powered threat detection, and smart contract auditing, Cytonic ensures maximum protection against cyber threats. Whether you’re securing DeFi protocols, NFTs, or enterprise blockchain systems, Cytonic’s cutting-edge security technology provides the highest level of data integrity and protection. https://cytonic.cc

  15. GarrettMom表示:

    bahis siteleri slot oyunlarД± yeni bonus veren bahis siteleri glГјcksspiel internet casinositeleri1st.shop

  16. Jeffreymop表示:

    UnagiSwap is a cutting-edge decentralized exchange (DEX) that provides fast, secure, and transparent crypto trading. Designed for traders looking to swap digital assets efficiently without intermediaries, UnagiSwap offers low fees, deep liquidity, and seamless smart contract execution. Whether you’re a casual trader or a professional investor, UnagiSwap’s non-custodial platform ensures full control over your assets in a decentralized environment. https://unagiswap.org

  17. BradyGem表示:

    sweet bonanza giris: sweet bonanza 1st – sweet bonanza 1st sweetbonanza1st.shop

  18. ElmerLon表示:

    HyperDrive is transforming the way data is stored and managed through decentralized storage and blockchain hosting solutions. Built for security, scalability, and efficiency, HyperDrive enables businesses, developers, and blockchain projects to store and distribute data without relying on centralized servers. By leveraging Web3 technology and distributed networks, HyperDrive ensures reliable, censorship-resistant, and high-performance storage solutions for the digital era. https://hyperdrive.ink

  19. GarrettMom表示:

    iddaa siteleri casibom guncel adres vidobet giriЕџ 2025 casibom1st.shop

  20. RobertCex表示:

    casino siteleri: deneme bonusu veren siteler – guvenilir casino siteleri casinositeleri1st.com

  21. TracyRak表示:

    Say hello to AquaSculpt—a game-changer in weight loss! These AquaSculpt capsules use natural AquaSculpt ingredients to shed pounds and boost confidence. No AquaSculpt side effects, just pure AquaSculpt results—see why in AquaSculpt reviews. Learn AquaSculpt how to use and join thousands who love it. AquaSculpt buy today at http://aquasculpt.me !

  22. Weldonsib表示:

    sweet bonanza giris: sweet bonanza siteleri – sweet bonanza 1st sweetbonanza1st.shop

  23. Weldonsib表示:

    sweet bonanza 1st: sweet bonanza oyna – sweet bonanza giris sweetbonanza1st.shop

發佈回覆給「mostbet_wvSr」的留言 取消回覆

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