This is a black swallowtail caterpillar forming its chrysalis, or pupating. This video shows what took about 20 minutes in less than 1 minute. You can see the "segments" of its body getting pushed to the bottom as the skin splits and the chrysalis is revealed. Then it squirms to get the shed skin off the bottom of the chrysalis. It's got to be one of the most amazing phenomena in nature. There's also video of another caterpillar pupating on my website http://www.WildlifeTheater.com.