Toggle navigation
Sign Up
Log In
Explore
Works
Folders
Tools
Collections
Artists
Groups
Groups
Topics
Tasks
Tasks
Jobs
Teams
Jobs
Recommendation
More Effects...
JS
(function() { jQuery(function($) { var $Canvas, $stats, HEIGHT, WIDTH, ambientLight, animate, camera, clock, directionalLight, geometry, material, mesh, render, renderer, scene, stats, uniforms; stats = new Stats(); $stats = $(stats.domElement); $stats.css({ position: "absolute", top: "0", left: "0" }); $("body").append(stats.domElement); WIDTH = window.innerWidth; HEIGHT = window.innerHeight; $Canvas = $("#Canvas"); scene = new THREE.Scene(); clock = new THREE.Clock(); renderer = new THREE.WebGLRenderer({ canvas: $Canvas[0], alpha: true }); $("#Notice").css("display", "none"); renderer.setClearColor(new THREE.Color(0x000000)); renderer.setPixelRatio(window.devicePixelRatio); renderer.setSize(WIDTH, HEIGHT); camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 3000); camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); camera.position.z = 4; geometry = new THREE.SphereGeometry(0.75, 100, 100); uniforms = THREE.UniformsUtils.merge([ THREE.UniformsLib["common"], THREE.UniformsLib["lights"], { time: { type: "f", value: 1.0 }, resolution: { type: "v2", value: new THREE.Vector2() } } ]); material = new THREE.ShaderMaterial({ lights: true, uniforms: uniforms, vertexShader: $("#noise4D").text() + $("#vertexShaderNoise").text(), fragmentShader: $("#noise3D").text() + $("#fragmentShaderNoise").text() }); mesh = new THREE.Mesh(geometry, material); scene.add(mesh); directionalLight = new THREE.DirectionalLight(0xffffff); directionalLight.position.set(1, 1, 1).normalize(); scene.add(directionalLight); ambientLight = new THREE.AmbientLight(0x101010); scene.add(ambientLight); $(window).on("resize", function() { WIDTH = window.innerWidth; HEIGHT = window.innerHeight; camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); return renderer.setSize(WIDTH, HEIGHT); }); animate = function() { requestAnimationFrame(animate); render(); return stats.update(); }; render = function() { var dt; dt = clock.getDelta(); uniforms.time.value += dt; uniforms.resolution.value.set(window.innerWidth, window.innerHeight); mesh.rotation.y += dt * 0.5; mesh.rotation.x += dt * 0.2; return renderer.render(scene, camera); }; return animate(); }); }).call(this);
CSS
body { position: relative; width: 100%; height: 100%; } #Canvas { position: absolute; width: 100%; height: 100%; } #Notice { font-size: 200%; text-align: center; color: red; } .mouseDisable { -moz-user-select: -moz-none; -ms-user-select: none; -webkit-user-select: none; user-select: none; }
HTML
Play with WebGL-enabled browser please.
Join Effecthub.com
Working with Global Gaming Artists and Developers!
Login
Sign Up
Or Login with Your Email Address:
Email
Password
Remember
Or Sign Up with Your Email Address:
Your Email
This field must contain a valid email
Set Password
Password should be at least 1 character
Stay informed via email