Placed in: Home arrow Art arrow Your own CSS parallax illusion 3d image
Your own CSS parallax illusion 3d image

A couple of days ago I placed an article about a parallax illusion with CSS: The Horse in Motion. Today I'll show you how I created such an image so you can do it yourself.

Own CSS Parallax Illusion

In this example, I'm going to use Photoshop for the actual image and Illustrator for the 3D effect. I wanted to try something else instead of the "frame by frame" (Like the Horse in Motion). Be creative! The final example (demo of the effect) looks pretty amazing and maybe even better than my previous one.

The foreground

Let's start with Photoshop. Go to File > New.. to start a new file. The size of this image is essential to understand the optical illusion and make it work. The width of the image is the number of frames you're going to use. In this tutorial and in the example I'll be using 6 frames, which means I'm going to make a foreground image of 6 pixels wide. The height doesn't matter, I just made it 10 px. Just make sure the Background Contents is set to Transparent. Now press OK to create the new file.

Use your Zoom Tool (Z) to zoom in a minimal distance. Now grab your Single Column Marquee Tool and select the most outer right column. Inverse the selection by going to Select > Inverse. Give that selection a color of #000000 with the Paint Bucket Tool (G).

Save this image as foreground.png by going to File > Save for Web & Devices. Make sure your preset is set to PNG-24 and have Transparency enabled. Don't close the image yet.

Because we'll need this image later, define it as a pattern. Do this by going to Edit > Define Pattern. Give your pattern a name. You can now close this Photoshop file.

Own CSS Parallax Illusion 01

The background

For the background image in this tutorial, we'll need to go to Illustrator. Draw any shape that you like, just keep in mind that it needs to rotate. The best way to draw a nice shape is by drawing circles, squares and lines. This is what I came up with. How simple can it get.

Own CSS Parallax Illusion 02

If you have multiple objects (like mine), select all objects. Now Right click > Group to make it one shape. With the shape still selected, go to Effect > 3d > Extrude & Bevel. A new window will open to set your 3d settings. I used the following settings & I recommend that you use the same. You can change the Extrude Depth and Perspective but not too much, otherwise it'll destroy the effect. Check the "Preview" box to see a live preview of your settings.

Own CSS Parallax Illusion 03

Save this image as 01.png by going to File > Save for Web & devices and also select the PNG output. Don't close the file yet, we still have some work to do.

Select the object. In the tab called Appearance double click on 3d Extrude & bevel to open up your 3d settings. Depending on the number of frames, you'll need to change the Rotation of the Y-axis. I'll be using 30 degrees because I create six frames (180 degrees / 6 frames = 30). Save this file as 02.png.

Keep on repeating this step, always adding the number of degrees to the Y-axis rotation (30 - 60 - 90 - 120 - 150). You should now have six images showing the rotation of your object.

Own CSS Parallax Illusion 04

Now get back to Photoshop. Create a new file, having the same dimensions as your images that you created from Illustrator. Place all your images (01.png - 06.png) in your new Photoshop file, each one on a new layer. Give the layer a new: 01 until 06, just for a reference.

Align all layers using Align Vertical and Align Horizontal to place all of them exactly at the center of your image. My example looks a little bit like a fat worm.

Own CSS Parallax Illusion 05

The following steps can hurt your eyes a little bit. Create a new layer on top of all your layers and give it a color of #FFFFFF using the Paint Bucket Tool (G). Now right-click in your layers-palette on the new layer and select Blending Options. In the new window, select Pattern overlay. Select the pattern that we made in the first step, using the default settings.

Duplicate the top layer. Select them both and Merge them (Ctrl+E) to create a flat image. Now go to Select > Color range. Make sure you have Sampled colors selected and select the whitefuzziness should be set to 0. Press OK to accept the settings and a selection of all white colors is made. Press Delete to get rid of them.

Here's how it should look at this point. I hide all layers 02 until 06 at this point.

Own CSS Parallax Illusion 06

Now for the fun (but hard and confusing) part. Hide all layers, except for the foreground. Go to Select > Color range and select the black parts. Un-hide layer 01 and make sure it's the active layer. Press "Delete" to delete those columns.

Don't de-select. If you want to make sure you did everything correct, your image (with the foreground layer hidden) should look like this.

Own CSS Parallax Illusion 07

With your selection still made, hide the 01 layer. Move your selection 1 px to the right using your arrow key (Nudging). Unhide layer 02 and press Delete. Repeat this step with all layers, each time moving the selection (parts to be deleted) 1 px to the right.

Now show all layers (except the foreground). This image can look pretty weird at this moment. Save the image as background.png.

Own CSS Parallax Illusion 08

HTML / CSS / Source / Demo

To understand the HTML and CSS behind this technique, I would recommend you to read the article 3d parallax background effect.

The simple way is to download my source in the download section (Includes source images, HTML & CSS) to get the same results as my example demo.

Conclusion

I know this technique is just a "proof of concept", but it's still pretty fun to see. Also, while rotating it looks like as if the center is replaced. This is correct and caused by Illustrator. You could better use applications like 3d Studio Max for 3d images.

Have fun creating your own illusion. Of course you could decide not to use Illustrator to create 3d images. You can also use six non-3d motion images like The Horse in Motion. Have fun share your creations in the comments.


Tags:  photoshop css illusion parallax

Interested in this topic? You might enjoy another article I've written called

Did you like this article? Subscribe to my feed or email to keep updated on new articles.

Spread the word and submit to:
Digg!Reddit!Del.icio.us!Facebook!StumbleUpon!
Comments
Add NewSearchRSS
grafik tasarim - css layer   2008-07-15 15:27:30
Gravatar image css layer examples / properties and layer attributes
http://css-lessons.ucoz.com/css-layer-properties.htm
Mike Sutherford - Magic Moving Images book!!   2009-12-04 12:25:52
Gravatar image Good effect but this book uses the technique on the printed page!
http://www.youtube.com/watch?v=S5W5JJXtqhw

A much better way of showing the animation as its unexpected and unnatural to see images which move in a real book.

Mike S.
Anonymous   2009-12-21 00:12:06
Gravatar image :cheer: :confused: :0 :angry: :( <img src=hock:' /> :evil: B) :dry: <img src=illy:' /> <img src=hock:' /> :X <img src=ide:' /> :) :P :unsure: :woohoo: :huh: :whistle: ;) :s :pinch: :D :kiss: :lol:
Umberto - São Paulo - Brasil - doubts about the tutorial   2010-01-29 17:53:51
Gravatar image Hello friend, here is Umberto of Brazil, I read your article on Create your own CSS parallax illusion 3d image, and I was amazed, most confess that I am having difficulties after leaving the Adobe Illustrator and return to work in Adobe Photoshop, especially in concerns after mounting layers, My difficulty is when it asks you to create a layer on all the latest on, the illustration and explanation is very good it was lost putting this on, if you can me makes clear step by step I am very grateful to you, without more wait in a big hug friend - umbertotavolaro@hotmail.com
Anonymous - re: doubts about the tutorial   2010-02-03 18:46:21
Gravatar image ok tank you friend
Marcelo José Franco   2010-11-11 18:35:33
Gravatar image Olá, tudo bem? Eu sou estudante de física e estava trabalhando numa feira de tecnologia esta semana e acabei conhecendo o livro magic moving images. Procurando sobre o assunto cheguei ao seu trabalho e gostei muito, mas não tenho o talento para trabalhar com fotoshop e ilustrator como vocês que trabalham com blog e sites. Consegui fazer a imagem que voce ensinou, mas depois não consegui criar outras. Gostaria de saber se você não tem outras imagens destas e se você poderia me envia las, se sim fico muito agradecido. Obrigado. Marcelo
Marcelo José Franco - ah, o email   2010-11-11 18:37:49
Gravatar image ah, eu coloquei para aparecer meu email para notificar meu email, mas não sei se ele aparece para você, vou deixa lo aqui. maarcelofranco@gmail.com obrigado
andrew   2010-11-18 20:10:21
Gravatar image Or you could try this web site. I thought it was awesome! Click Here!
pharmacy information seeking - pharmacy information seeking   2011-06-10 09:53:44
Gravatar image I am strongly associated with this site. As this site has inspired me a lot always in a new way and made my work easy by every time highlighting on the new issue and make me pleased. Thanks you people rock!!!!!!
anti smoking pills data - anti smoking pills data   2011-06-10 09:55:53
Gravatar image I am frequent reader of the articles and new knowledgeable post about new things always and would be searching new stuff for that. And I really thank you people for providing us new articles and post. Thanks a lot!
worlds best anti smoking pills - worlds best anti smoking pills   2011-06-10 09:56:26
Gravatar image It was really surprising to see such a wonderful post that is inspiring and informative and caught the attention of many people. I am a regular visitor of the blog and love the work of these people.
halt hair loss treatment - halt hair loss treatment   2011-06-10 09:57:06
Gravatar image This is a wonderful website that has great info and is helpful for one and all. I always look forward for your website to gather any kind of information. Hope you people do like this only wonderful job. Cheers
online pharmacy listing clinic - online pharmacy listing clinic   2011-06-10 09:57:59
Gravatar image I often like surfing on net and find info on new things and this time I got a new website which has great info and is quite brilliantly written. Am just thrilled and excited to see this and hope to see more work of you people in future.
pharmacy online blog - pharmacy online blog   2011-06-10 09:59:16
Gravatar image I enjoy reading the post and have become a great fan of yours. Keep up with the good job and please provide us with great blogs. I really appreciate the research you people take for the posts.
pharmacy tips - pharmacy tips   2011-06-10 10:00:14
Gravatar image It was perfect collection of such useful information. This was a helpful post foe me. Thanks for sharing such nice information. Thanks a lot!
better drug store - better drug store   2011-06-10 10:01:01
Gravatar image It was perfect collection of such useful information. This was a helpful post foe me. Thanks for sharing such nice information. Thanks a lot!
hair loss comic - hair loss comic   2011-06-10 10:01:41
Gravatar image I was a great experience to read your post. I found your site from Google and thank a lot for this nice and wonderful information. The information posted was useful and interesting.
anti smoking pills center - anti smoking pills center   2011-06-10 10:02:15
Gravatar image Thanks a lot for such a wonderful post, the stuff posted were really interesting and useful. The quality of the content was good and clear. Thanks for the post
overweight pill - overweight pill   2011-06-10 10:02:58
Gravatar image I appreciate the ideas posted on your site; they were very informative and innovative. It was worth visiting your site. Thanks a lot for such valuable information.
better pharmacy blog - better pharmacy blog   2011-06-10 10:04:14
Gravatar image I was very pleased to visit your site; I was definitely a wonderful site. The post was worth reading. I enjoyed each bit of your post. Thanks for such excellent post.
rajendra - WebHostingPad   2011-08-02 09:55:32
Gravatar image This is very great info by providing the nice info in this blog and useful info is visible in this blog. I had really like it very much for useful info in this website. I am really like it very much for useful info in this blog. I had really like it very much for using the nice info in this blog. This is very much interesting info in this blog. Thank a lot for sharing the nice info in this blog.
Anonymous   2011-08-26 22:55:22
Gravatar image :angry: :0 :confused: :X <img src=hock:' /> :( :) :s :D :kiss: :whistle: :unsure: :evil: :evil: <img src=illy:' /> :dry: :dry: <img src=illy:' /> :dry: :lol: :kiss: :kiss: :whistle: :woohoo: :P :P :( <img src=hock:' /> :0 :X :confused: <img src=ide:' /> :cheer: :) B) :P :evil: <img src=illy:' /> :unsure: :woohoo: :dry: :lol: :huh: :lol: :kiss: :D :D :D :s :P
SEO victoria - SEO Victoria   2012-09-11 15:40:43
Gravatar image These are actually great examples of this effect, looking for a pure CSS3 effect, let me know if you know of any.
Read more...
Name:
Email:
  Gravatar enabled.
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Security Image
Please input the anti-spam code that you can read in the image.
Unsubscribe from e-mail notifications.
 
< Prev   Next >
Subscribe

Subscribe to Marcofolio