Edge Animate parallax composition ready equivalent in Hype

Hello @Lancedboyle,

well, to be honest, you will not need JQuery …

Place it on sceneload:

	//your destinated timelinename
	var destTimelineName =  'test',
	
	//get duration
	timelineDuration = hypeDocument.durationForTimelineNamed(destTimelineName),
	
	//get active sceneelement, -> http://forums.tumult.com/t/extend-tumult-hype-with-javascript-hypedocument-extensions/6847/18
	activeScene = document.querySelector('#'+ hypeDocument.documentId() +' > .HYPE_scene[style*="block"]');
	
	//check if listener is already set
	if(!activeScene.hasAttribute(destTimelineName))
	{
	
	//set listener
	activeScene.addEventListener('mousemove', 	
	function (e){
	//get desttime
	var max = hypeDocument.getElementProperty(activeScene, 'width');
	var eventLeft = e.pageX;
	var sceneLeft = activeScene.getBoundingClientRect().left;
	var relLeft = eventLeft - sceneLeft;
	var destTime = (relLeft/max)*timelineDuration;
	//set desttime
	hypeDocument.goToTimeInTimelineNamed(destTime, destTimelineName);
	}, 
	false);
	
	//set attibute for listenercheck
	activeScene.setAttribute(destTimelineName, 'true');
	}
3 Likes