Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Time to Play

Members
  • Joined

  • Last visited

Everything posted by Time to Play

  1. Hello, I'm trying to add a background to a webgl scene(Three.js). The scene contains two animated spritesheets that I created using DAZ3D and Photoshop. I've tried just about everything but to no avail, the background is either white or black. I've tried many examples on the web then either my spritesheet animator won't work or the background won't appear. I read that I need to make two scenes with two camera's, but that doesn't seem to work as well. I really don't understand why I would need to have two scenes anyway. <script> // standard global variables var container,scene,camera,renderer,controls,stats; var keyboard = new THREEx.KeyboardState(); var clock = new THREE.Clock(); // custom global variables var attack,defense; init(); animate(); // FUNCTIONS function init(){ // SCENE scene = new THREE.Scene(); // CAMERA var SCREEN_WIDTH = window.innerWidth,SCREEN_HEIGHT = window.innerHeight; var VIEW_ANGLE = 45,ASPECT = SCREEN_WIDTH / SCREEN_HEIGHT,NEAR = 0.1,FAR = 1000; var light = new THREE.PointLight(0xEEEEEE); var lightAmb = new THREE.AmbientLight(0x777777); camera = new THREE.PerspectiveCamera(VIEW_ANGLE,ASPECT,NEAR,FAR); scene.add(camera); camera.position.set(-10,30,400); camera.lookAt(scene.position); // RENDERER if (Detector.webgl) renderer = new THREE.WebGLRenderer({antialias:true}); else renderer = new THREE.CanvasRenderer(); renderer.setSize(SCREEN_WIDTH,SCREEN_HEIGHT); container = document.getElementById('ThreeJS'); container.appendChild(renderer.domElement); // EVENTS THREEx.WindowResize(renderer,camera); THREEx.FullScreen.bindKey({charCode :'m'.charCodeAt(0)}); // LIGHTS light.position.set(20,0,20); scene.add(light); scene.add(lightAmb); // BACKGROUND var texture = THREE.ImageUtils.loadTexture('images/sky.jpg'); var backgroundMesh = new THREE.Mesh(new THREE.PlaneGeometry(2,2,0),new THREE.MeshBasicMaterial({map:texture})); backgroundMesh.material.depthTest = false; backgroundMesh.material.depthWrite = false; var backgroundScene = new THREE.Scene(); var backgroundCamera = new THREE.Camera(); backgroundScene.add(backgroundCamera); backgroundScene.add(backgroundMesh); // FLOOR var floorTexture = new THREE.ImageUtils.loadTexture('images/checkerboard.jpg'); floorTexture.wrapS = floorTexture.wrapT = THREE.RepeatWrapping; floorTexture.repeat.set(10,10); var floorMaterial = new THREE.MeshBasicMaterial({map:floorTexture,side:THREE.DoubleSide,shininess:30}); var floorGeometry = new THREE.PlaneGeometry(1000,1000); var floor = new THREE.Mesh(floorGeometry,floorMaterial); floor.position.y = -0.5; floor.rotation.x = Math.PI / 2; scene.add(floor); // MESHES WITH ANIMATED TEXTURES! var attackerTexture = new THREE.ImageUtils.loadTexture('images/kitinalevel2.png'); attack = new TextureAnimator(attackerTexture,2,13,26,25); // texture,#horiz,#vert,#total,duration. var attackerMaterial = new THREE.MeshBasicMaterial({map:attackerTexture,side:THREE.DoubleSide,transparent:true}); var attackerGeometry = new THREE.PlaneGeometry(50,50,1,1); var attacker = new THREE.Mesh(attackerGeometry,attackerMaterial); attacker.position.set(-5,20,350); scene.add(attacker); var defenderTexture = new THREE.ImageUtils.loadTexture('images/kitinalevel1.png'); defense = new TextureAnimator(defenderTexture,2,13,26,25); // texture,#horiz,#vert,#total,duration. var defenderMaterial = new THREE.MeshBasicMaterial({map:defenderTexture,side:THREE.DoubleSide,transparent:true}); var defenderGeometry = new THREE.PlaneGeometry(50,50,1,1); var defenderx = new THREE.Mesh(defenderGeometry,defenderMaterial); defenderx.position.set(25,20,350); scene.add(defenderx); } function animate(){ requestAnimationFrame(animate); render(); update(); } function update(){ var delta = clock.getDelta(); attack.update(1000 * delta); defense.update(1000 * delta); //controls.update(); //stats.update(); } function render(){ renderer.autoClear = false; renderer.clear(); renderer.render(scene,camera); renderer.render(backgroundScene,backgroundCamera); } function TextureAnimator(texture,tilesHoriz,tilesVert,numTiles,tileDispDuration){ // note:texture passed by reference,will be updated by the update function. this.tilesHorizontal = tilesHoriz; this.tilesVertical = tilesVert; // how many images does this spritesheet contain? // usually equals tilesHoriz * tilesVert,but not necessarily, // if there at blank tiles at the bottom of the spritesheet. this.numberOfTiles = numTiles; texture.wrapS = texture.wrapT = THREE.RepeatWrapping; texture.repeat.set(1 / this.tilesHorizontal,1 / this.tilesVertical); // how long should each image be displayed? this.tileDisplayDuration = tileDispDuration; // how long has the current image been displayed? this.currentDisplayTime = 0; // which image is currently being displayed? this.currentTile = 0; this.update = function(milliSec){ this.currentDisplayTime += milliSec; while(this.currentDisplayTime>this.tileDisplayDuration){ this.currentDisplayTime-=this.tileDisplayDuration; this.currentTile++; if (this.currentTile == this.numberOfTiles) this.currentTile = 0; var currentColumn = this.currentTile%this.tilesHorizontal; texture.offset.x = currentColumn/this.tilesHorizontal; var currentRow = Math.floor(this.currentTile/this.tilesHorizontal); texture.offset.y = currentRow/this.tilesVertical; } }; } </script> What am I doing wrong? Thanks in advance.
  2. Thanks for that. I see he wrote a book HTML 5 Canvas for Games and Entertainment. Seems like a good point to start this journey.
  3. Thanks a lot for the answers, much appreciated.
  4. ..what technique to dive into. I have no problem creating the game itself, already made a cms to create the characters, cities, weapons etc. The thing that is really making my brain crack is the animation part. I want to have fights similar to good ol' 7th saga - snes. I'd rather stay away from flash and would love to learn something new, I've seen webgl and canvas, is it worth diving into that or is flash the way to go? Thanks in advance.
  5. Thanks for your reply. I'm using win7 64bit as OS. I checked the manual which didn't say anything about it being only available to people from certain regions nor did the install program mention anything. To me this is weird, why doesn't it just work out of the box. Even changing the region didn't have any effect.
  6. So I bought this drawing tablet from Huion (model 580), once installed I tried to draw with it. Instead I got this message "The writing pad is not available for the input language you have selected". My default language is Dutch, I changed this to English, also changed the region but still got the same error. Then I googled it, but people with similar problems didn't get any reply... Pfff what can I do now? Hope anyone can help me out. Thanks!
  7. I'm pretty sure I'm not the only one (at least on this planet) who thinks it's annoying that when you open an image, that the layer is locked and you will have to duplicate it first or you won't be able to do certain things with the layer. Is there a way that when you open an image that the restriction doesn't appear? TBH I don't quite get the point of it anyway, why the layer is always locked when you open a single layered image.
  8. I'm making a game in which you will have to code php programs in order to go to the next round. I'm kind of stuck with one game, the idea is to get the x-th link for a random keyword on a random site in google..the user will have to post back the correct answer. I'm trying to get basically all links containing class 'l'. I've tried several pregs, but I cant just find the right syntax: <?php preg_match_all('/<a href="([^"]*)" class="l"([^>]*)>(.*)<\/a>/isU',$sResult,$aOutput); ?> Hope anyone can give me a push in the right direction, thanks in advance.
  9. I'll give that a try when I get back thanks. It's the last part of the form, after I submit the form the value will always be empty...with my piece of code the sBla field does appear, that's not the problem, but when form is submitted $_POST['sBla'] will always have the value of in this case 'bla' no matter what I type into the field. Thanks though for your effort in writing the code.
  10. I'm making a form that changes options when eg a selection menu has a certain value. The weird thing is that it 'works' in terms of 'the fields that should be displayed are displayed'...however when I use the line below.. ..the form field sBla will always stay 'bla' even if I change it's content..have tried to remove the value property but that didn't help either, even if I type something inside it stays empty...what am I doing wrong? cheers
  11. I'm in need of a tool that allows you to go through all images on the harddisk, atm I have access to picasa3 and adobe bridge, I prefer picasa 3 as it allows me to scroll through all images very easily with previews. Bridge is less efficient imo when u have a collection of 100000+ images. Picasa3 however doesn't index images with small dimensions eg 32x32px, so I'm in search of a program that can index every single image in eg folder "Design". I don't mind if the tool costs money, as it will spare me much more time. Anyone know of such program?
  12. What I'm trying to do is create a jQuery navigation that will act as a layer above content below it, the navigation works ok, but it makes space for itself and pushes the content down below it. I just cut the relevant code and pasted it into the code tags below, I'm really curious on what I'm missing here... anyone can help me out? Thanks in adavnce. <style type="text/css"> div.prfnav { margin:5px;color:#99ccff; } li.prfhdr { width:200px;color:#ffffff;font-size:13px;float:left; } li.prfhdr ul { display:none;list-style:none;background-color:#99ccff;overflow:auto; } li.prfhdr { list-style:none; } li.prfhdr:hover ul { display:block; } </style> <div class="prfnav"> <li class="prfhdr">Profile Info <ul> <li class="prflnk">link</li> </ul> </li> <li class="prfhdr">Modify Profile <ul> <li class="prflnk">link</li> </ul> </li> <li class="prfhdr">Actions <ul> <li class="prflnk">link</li> </ul> </li> </div>
  13. Thanks I'm checking it out right away.
  14. Thanks for the welcome, oh and enjoy your stay in November.
  15. One of my customers asked for a decent auction script, I don't have much time to code it as he needs it within a week. So I'm looking for a program that can do this, don't really care if it's open source or commercial as long as it's stable, his budget is max. 500 dollar. Anyone know of a good script? Thanks!
  16. Bumped into this forum after a quick Google search, really liked the layout and it seems like cool community to me. Little bit about myself: I'm 32 y/o, live in Amsterdam(actually a few miles away from it), I love weightlifting and consuming lots of food. My daily job is PHP programmer and (web)penetration tester. The main reason I registered is that I suck at CSS, I bump many times into stuff that makes my hair go grey and would love to share those thing with you, hehe. Cheers brothers and sisters.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.