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

461 Responses

  1. AnthonyNuami表示:

    Those absolute gladiators from Slots Empire Casino are offering quite a tasty little deal especially for you! The really cool Gladiator inspired site are offering a good looking welcome bonus to all new players and we can’t get enough of it! You will not want to miss out on this! Slots Empire No Deposit Bonus Codes – $5 Free! use Bonus Code: 5GRATIS Read our review of Slots Empire Casino Some of the most popular slots on offer at Slots Empire Casino are: РђddРµd by: РЎhris РђdР°ms Slots Empire accepts the following currencies: Australian Dollars – AUD, Bitcoin, Euro – EUR, Norwegian Kroner – NOK, US Dollar – USD Please play responsibly. Copyright В© 2020 Bobby Casino Rory Medcalf, head of the National Security College at the Australian National University, described the draft document as symptomatic of “Belt and Road colonialism, China’s Indo-Pacific empire”. https://nostalgirock.se/community/profile/williseasterbro/ For an authentic live casino experience on the go, you can play the best live dealer casino games via your app. The number of live casino variants available for mobile devices has grown significantly, with some casinos offering you hundreds of live casino games to choose from on your mobile device. Everything from live blackjack to live roulette, live baccarat, and live poker. Mr Green’s mobile casino app is at the top of the list after clinching the 2016 title of ‘Mobile Operator of the Year’ at the International Gaming Awards, following wins in the ‘Online Casino Operator’ category three years running. The app carries the same stylish colour scheme from the website, reworked for the mobile device. The methods of transferring money at an iPhone iPad casino are the same as at any online casino. Any Canadian bank card will work, as will transferring funds directly from your bank account. Most casinos also offer the option for eWallet transfers using InstaDebit, iDebit and Paysafecard.

  2. I have been surfing online greater than three hours as of late, but I never discovered any interesting article like yours. It¦s pretty price sufficient for me. In my view, if all site owners and bloggers made just right content as you probably did, the net might be a lot more useful than ever before.

  3. AnthonyNuami表示:

    You can also find reviews of the top USA casino promo codes at USACasinoCodes.com. Mission and values Par a dice casino reviews Practical travel advice to help you choose the best time for a vacation. Booking, reviews and advice on hotels, resorts, vacation rentals, travel packages, and a lot more! Par A Dice Hotel Casino East Peoria Useful Findings Playing host to plush guestrooms and inviting amenities, the Casino Peoria IL is ideal for that worry-free vacation in Peoria. Peoria Riverboat Casino stands a short drive from several local attractions including the Peoria Civic Center, Peoria Riverfront Museum and the Contemporary Art Center of Peoria.  Paradice Peoria offers complimentary amenities including parking, wireless internet access and local calls. Par A Dice also offers air conditioned guestrooms complete with 37-inch cable televisions, beds with down comforters and safes as well as phones, refrigerators and coffeemakers.   https://cainludhiana.com/community/profile/christineshippe/ Spicy Spins live casino offers a golden chance for the fans of online gaming who will freely play with other players from different parts of the world. Enjoy playing roulette and poker among the few table games available together with numerous jackpots awaiting you. Other games involved here at Spicy Spins casino include slots like the Golden Royals and the Book of Tattoo. Ein Online Casino bietet im Allgemeinen eine Webseite an, auf der Du Spielautomaten und Online Casinospiele, sowohl kostenlos als auch um echtes Geld spielen kannst. Bevor Du den Spaß genießen kannst, musst Du als Spieler zunächst ein neues Konto registrieren. Danach steht es Dir frei, eine Einzahlung zu tätigen, einen Casino Bonus (wie z.B. einen Willkommensbonus) zu beanspruchen und eine erstklassige Auswahl an Spielen wie Starburst, Stunning Hot und Piggy Riches Megaways™ zu genießen. Bei EnergyCasino haben registrierte und verifizierte Spieler Zugang zu kostenlosen Demos, über 2.000 Spielen und Spielautomaten-Turnieren mit vielen Belohnungen wie Spins, Boni und sogar Bargeld.

  4. best place to buy cenforce comprar cenforce contrareembolso cenforce soft buy cenforce 150 mg online with paypal in usa

  5. furosemide generic name furosemide 20mg furosemide 40 mg no prescription how long does lasix is completely out of your body

  6. Sweet blog! I found it while browsing on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Thank you

  7. tbrsjwac表示:

    buy hydroxychloroquine online cheapest plaquenil online

  8. Tips and tools you offer are so helpful to agencies in our community.

  9. lcsdcigy表示:

    buy hydroxychloroquine sulfate online hydroxychloroquine buy online

  10. mcafsbwc表示:

    https://www.hydroxychloroquinex.com/ canada pharmacy hydroxychloroquine

  11. Our family had similar issues, thanks.

發佈留言

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