Luffy isn't a maniac laughing for no reason, he started to laugh a lot when he became one of the strongest in the world and overcame basically all challenges he would have on the path of getting the One Piece, Imu wasn't supposed to happen and Blackbeard isn't strong enough to challenge him yet.
By the point Luffy started laughing and playing around in his fights, the One Piece world top ranking looked like:
1. Imu ( if you want to count him )
2. Kaido ~ Big Mom ~ Shanks ~ Mihawk
3. Luffy ~ Blackbeard
When he gets to the point where he matches the strongest in the world and one shots almost anyone who isn't among those 6 characters, 1 of which he didn't know existed ( Imu ), and 4 of them who posed no threat to him ( Kaido, Big Mom, since they were taken out, Mihawk, Blackbeard ), and the other one being his friend and mentor, it makes sense to just laugh and have fun
By the point Luffy started laughing and playing around in his fights, the One Piece world top ranking looked like:
1. Imu ( if you want to count him )
2. Kaido ~ Big Mom ~ Shanks ~ Mihawk
3. Luffy ~ Blackbeard
When he gets to the point where he matches the strongest in the world and one shots almost anyone who isn't among those 6 characters, 1 of which he didn't know existed ( Imu ), and 4 of them who posed no threat to him ( Kaido, Big Mom, since they were taken out, Mihawk, Blackbeard ), and the other one being his friend and mentor, it makes sense to just laugh and have fun