Check out this code snippet for some help: http://jsfiddle.net/ebeit303/e5Q3N/1/
<!DOCTYPE html>
<html lang="en>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js" ></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/three.js/r61/three.min.js" ></script>
</head>
<body >
<script>
var container;
var camera, scene, renderer;
var group;
container = document.createElement('div');
document.body.appendChild(container);
$(document).ready(function() {
try {
init();
}
catch (e) {
container.innerHTML = e.toString();
}
});
function init() {
// Setting up renderer
renderer = new THREE.WebGLRenderer({antialias: true});
renderer.setClearColorHex(0xADD8E6, 1);
renderer.setSize(window.innerWidth, window.innerHeight);
container.appendChild(renderer.domElement);
// Setting up camera
camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 2100);
camera.position.z = 1000;
scene = new THREE.Scene();
group = new THREE.Object3D();
scene.add(group);
var tUrl = "http://www.mediafire.com/convkey/7344/ra2l3kgscpvjflafg.jpg";
var texture = THREE.ImageUtils.loadTexture(tUrl, {}, spriteMesh);
window.addEventListener('resize', onWindowResize, false);
animate();
}
function spriteMesh(ashTexture) {
// Creating sprites
var ashMaterial = new THREE.SpriteMaterial({map: ashTexture});
var Ash = new THREE.Sprite(ashMaterial);
var imageWidth1 = ashMaterial.map.image.width;
var imageHeight1 = ashMaterial.map.image.height;
Ash.scale.set(3 * imageWidth1, 3 * imageHeight1, 1.0);
Ash.position.set(2 * imageWidth1, 2 * imageHeight1, 1.0);
group.add(Ash);
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
}
function animate() {
requestAnimationFrame(animate);
update();
render();
}
function update() {
camera.lookAt(scene.position);
camera.updateProjectionMatrix();
}
function render() {
renderer.render(scene, camera);
}
</script>
</body>
</html>