Bre.ad has this background where it keeps moving and there is an illusion of a baker’s truck moving on the road. I was wondering how that was done and can it be done so that the image is moving vertically instead of horizontally?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The entire background is this long png file, and the city scapes and clouds are transparent background pngs that are layered over it in multiple divs.
Background (Town):
CityScape:
The relevant HTML from the page source:
and the relevant CSS from
all.cssand similarly for the other divs. The
repeat-xproperty is used to repeat the background so as to mimic the effect of continuous scrolling. Also, the left end of the image and the right end line up, so as to give a smooth transition.The animation is done by
homepage.jswhich slowly shifts thebackground-positionlinearly. The relevant lines are: