Solved

how implement camera focus effect in jquery ?

Posted on 2010-11-23
6
573 Views
Last Modified: 2012-05-10
is any one have idea to how implement zoom effect like
this website :http://www.absacapital.com/Pages/AbsaCapital.aspx
0
Comment
Question by:imperlish
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 43

Expert Comment

by:Rob
ID: 34208073
0
 
LVL 43

Expert Comment

by:Rob
ID: 34209118
http://slides.html5rocks.com/ is a great tutorial on how to achieve this using HTML5
0
 

Author Comment

by:imperlish
ID: 34225074
yes like this :http://mrdoob.com/118/Rotozoomer_HTML5
but not moving forward, i need to zoom on div and on event zoomout.
0
 
LVL 43

Accepted Solution

by:
Rob earned 500 total points
ID: 34503592
That page uses the svg tag and javascript, yoiu should be able to adapt it:

<div id="container"><svg width="1440" height="724"><defs><pattern id="texture" patternUnits="userSpaceOnUse" width="270" height="270" patternTransform="translate(563.0617437339367, 425.58112281380807) scale(0.3939994872616265) rotate( 284.4186557036039)"><image width="270" height="270" preserveAspectRatio="none" href="meanman.png"></image></pattern></defs><rect width="1440" height="724" style="fill:url(#texture)"></rect></svg></div>

Open in new window


<script type="text/javascript">

			var SCREEN_WIDTH = window.innerWidth, SCREEN_HEIGHT = window.innerHeight,
			SCREEN_WIDTH_HALF = SCREEN_WIDTH / 2, SCREEN_HEIGHT_HALF = SCREEN_HEIGHT / 2,
			
			texturePattern;

			init();
			setInterval(loop, 1000/60);

			function init()
			{
				var container, svg;
				
				container = document.getElementById('container');

				svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
				svg.setAttribute('width', SCREEN_WIDTH);
				svg.setAttribute('height', SCREEN_HEIGHT);

				var defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs');
				svg.appendChild(defs);

				texturePattern = document.createElementNS('http://www.w3.org/2000/svg', 'pattern');
				texturePattern.setAttribute('id', 'texture');
				texturePattern.setAttribute('patternUnits', 'userSpaceOnUse');
				texturePattern.setAttribute('width', 270);
				texturePattern.setAttribute('height', 270);
				defs.appendChild(texturePattern);

				var texture = document.createElementNS('http://www.w3.org/2000/svg', 'image');
				texture.setAttribute('width', 270);
				texture.setAttribute('height', 270);
				texture.setAttribute('preserveAspectRatio', 'none');	
				texture.setAttributeNS('http://www.w3.org/1999/xlink', 'href', 'meanman.png');
				texturePattern.appendChild(texture);
				
				var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
				rect.setAttribute('width', SCREEN_WIDTH);
				rect.setAttribute('height', SCREEN_HEIGHT);
				rect.setAttribute('style', 'fill:url(#texture)');
				svg.appendChild(rect);
				
				container.appendChild(svg);
			}

			function loop()
			{
				var timer, scale, tx, ty, rotate;
			
				timer = new Date().getTime();

				tx = SCREEN_WIDTH_HALF + Math.sin(timer * 0.0001) * 256;
				ty = SCREEN_HEIGHT_HALF + Math.cos(timer * 0.0002) * 256;
				scale = (Math.sin(timer * 0.0002) + 1.1) * 3;
				rotate = Math.cos(timer * 0.0001) * 360;			

				texturePattern.setAttribute('patternTransform', 'translate(' + tx + ', ' + ty + ') scale(' + scale + ') rotate( ' + rotate + ')');
			}
	
		</script>

Open in new window

0
 
LVL 31

Expert Comment

by:James Murrell
ID: 36434003
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
The viewer will learn how to dynamically set the form action using jQuery.
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question