javascript - How to Animate Splitting Different Layers of an Image (product image) in Landing Page -


i want animate splitting of product image when user scrolls section. i.e. when user scrolls down , enters product image section, want trigger animation of revealing different layers/composition of product. done here (scroll down second section after landing page):

https://simbasleep.com/

a pure css3 solution preferred. however, library solutions such jquery, gsap, etc welcome.

you can use scrollmagic lib http://scrollmagic.io/examples/expert/image_sequence.html

docs example:

// define images  	var images = [  		"../../img/example_imagesequence_01.png",  		"../../img/example_imagesequence_02.png",  		"../../img/example_imagesequence_03.png",  		"../../img/example_imagesequence_04.png",  		"../../img/example_imagesequence_05.png",  		"../../img/example_imagesequence_06.png",  		"../../img/example_imagesequence_07.png"  	];    	// tweenmax can tween property of object. use object cycle through array  	var obj = {curimg: 0};    	// create tween  	var tween = tweenmax.to(obj, 0.5,  		{  			curimg: images.length - 1,	// animate propery curimg number of images  			roundprops: "curimg",				// integers can used array index  			repeat: 3,									// repeat 3 times  			immediaterender: true,			// load first image automatically  			ease: linear.easenone,			// show every image same ammount of time  			onupdate: function () {  			  $("#myimg").attr("src", images[obj.curimg]); // set image source  			}  		}  	);    	// init controller  	var controller = new scrollmagic.controller();    	// build scene  	var scene = new scrollmagic.scene({triggerelement: "#trigger", duration: 300})  					.settween(tween)  					.addindicators() // add indicators (requires plugin)  					.addto(controller);    	// handle form change  	$("form.move input[name=duration]:radio").change(function () {  		scene.duration($(this).val());  	});


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -