clicking functions and animation code