From the Super Mario Wiki
Retrieved from "https://www.mariowiki.com/index.php?title=Yarn_Ball&oldid=2312082"
A Yarn Ball is at item specific to Yoshi's Woolly World. It is the equivalent of a Yoshi Egg from most Yoshi games. Yarn Balls can be thrown at frame structures to weave pipes or Present Boxes around them, as well as attack enemies and retrieve items. They can be obtained after Yoshi unravels an enemy, or hits an Egg Block from beneath.
Yarn Balls come in three different sizes: the standard size, the large size, and the extra large size; aside from their dimensions, standard, large, and extra large yarn balls differ by resistance when thrown. Whilst the standard-sized ones break after only one encounter with an enemy or object, such as a Winged Cloud, the bigger yarn balls can pass through a multitude of such elements before unstringing themselves.
The color of a Yarn Ball depends on the color of the enemy Yoshi swallowed. For example, eating a red Shy Guy results in acquiring a red yarn ball, and after eating a Boo Guy, the yarn ball will be white, and so on. Yarn Balls from Egg Blocks, however, are randomly colored, but might follow a strict pattern of colors depending on the level's theme and the color tints of its background elements.