Cocos creator simulates the starry sky effect

  • zero
    give the thumbs-up
  • step on
  • zero
    Collection
    Think it's good? One click collection
  • zero
    comment
You can use the following steps to Cocos Creator 3.7.1 Medium simulation Book turning effect 1. Create a new scene, and then add two Sprite nodes to the scene, one for displaying the current page and the other for displaying the next page. 2. Add a PageView component for two Sprite nodes, which will allow you to slide and page. 3. Create a mask component on the Sprite node of the current page and set its size to be the same as the Sprite node. Then, add a Layout component to the Mask node, and set the Anchor of Layout to (0, 0) and its Position to (0, 0). 4. Create two Sprite nodes on the Layout node, one for displaying the left half of the current page and the other for displaying the right half. Set the size of these two nodes to be the same as Layout, and set their positions to (0, 0). 5. Add a widget component on the Sprite node in the left half of the current page, and set its Anchor to (0, 0.5), which will make it horizontally centered and vertically aligned. 6. Add a widget component on the Sprite node in the right half of the current page, and set its Anchor to (1, 0.5), which will make it horizontally centered and vertically aligned. 7. Repeat steps 3-6 on the Sprite node on the next page, but set the anchor of the Sprite node in the left half to (1, 0.5) and the anchor of the Sprite node in the right half to (0, 0.5), which will make them display correctly when turning pages. 8. Add a Button component on the Sprite node in the left half of the current page, set its size to be the same as the Sprite node, and set its Anchor to (0, 0.5). Create a new script on the Button node and name it FlipPage. In the FlipPage script, add an OnClick event and bind it to a new function. 9. In the FlipPage function, get the PageView component and call its setCurrentPageIndex function to set it as the index of the current page+1, which will make it slide to the next page. 10. Add a Button component to the Sprite node in the left half of the next page, and repeat steps 8 and 9, which will allow you to turn back to the current page on the next page. 11. Finally, add a new script to the scene and name it "BookFlip". In the BookFlip script, add an onPageTurning event and bind it to a new function. 12. In the onPageTurning function, get the PageView component and the index of the current page. Then, get the left and right Sprite nodes of the current page, and the left and right Sprite nodes of the next page. Use Tween animation to move the Sprite node in the left half of the current page and the Sprite node in the right half of the next page to the left, and move the Sprite node in the right half of the current page and the Sprite node in the left half of the next page to the right, so that simulation Page turning effect So that you can Cocos Creator 3.7.1 Medium simulation Book turning effect Yes!

Is "relevant recommendation" helpful to you?

  • Very unhelpful
  • No help
  • commonly
  • to be helpful to
  • Very helpful
Submit
comment
Add Red Packet

Please fill in the red envelope greeting or title

individual

The minimum number of red packets is 10

element

The minimum amount of red packet is 5 yuan

Current balance three point four three element Go to recharge>
To be paid: ten element
Achieve 100 million technicians!
After receiving, you will automatically become a fan of the blogger and the red envelope owner rule
hope_wisdom
Red packet sent
Paid in element
Payment with balance
Click to retrieve
Scan code for payment
Wallet balance zero

Deduction description:

1. The balance is the virtual currency of wallet recharge, and the payment amount is deducted at a ratio of 1:1.
2. The balance cannot be directly purchased and downloaded, but VIP, paid columns and courses can be purchased.

Balance recharge