javascript - JS/CSS Combo - Getting 3D Image Wrap Effect -
i'm trying 3d wrap effect images on website. 3d wrap 1 in image
the effect require in image
the following pure css i'm using implement @ moment.
.gallery-wrap{ background-color: rgba(0,0,0,0); -webkit-box-shadow: 0 0px 0px 0px black !important; -moz-box-shadow: 0 0px 0px 0px black !important; box-shadow: 0 0px 0px 0px black !important; } .gallery-wrap img{ transform: perspective(400px) rotatey(10deg) translatex(7.5%) translatey(30px); margin-bottom: 5em !important; background-color: rgba(0,0,0,0); -webkit-box-shadow: 0 5px 7px -1px black; -moz-box-shadow: 0 5px 7px -1px black; box-shadow: 0 5px 7px -1px black; } .gallery-wrap div:after{ content: ''; width: 5%; height: 96%; background-image: url('<url of same image wrapped>'); position: absolute; top: 0px; transform: perspective(250px) rotatey(-55deg) translatey(7px) translatex(-10px); left: 0px; background-size: 10% 750%; background-position-x: 0%; }
the code works, problem doesn't work images. image more height width result in above code.
i wondering if me out js algorithm/point me existing (preferably free) js this. algorithm should capture width , height of img
element , render transform
values above code.
figured out. code follows
.gallery-wrap{ perspective: 1000px; //required correct 3d depth } .gallery-wrap div:after{ content: ''; position: absolute; left: 0; bottom: 0; width: 36px; height: 100%; background: inherit; background-size: cover, cover; background-position: left; //this , next 2 lines left edge. change bottom/top/right accordingly transform: rotatey(90deg); // y axis of rotation. change accordingly. 90deg flip (mirror) image transform-origin: left; // side flipped } .gallery-wrap div { display: block; height: 100%; background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url("<image_link>"); // add gradient effect farther side background-size: 0, cover; //to gradient effect transform-style: preserve-3d; transition: 0.5s; margin: 10% auto; // , next line 2 line dimension adjustments width: 80%; transform: rotatey(37.5deg); // main image rotation transform-origin: center; // point of origin of transform. use center best effect; }
the image has used background image.
structure of elements - .gallery-wrap > div
credits original source - thecodeplayer
Comments
Post a Comment