Three.js game · Portrait mobile

FRUIT SLASH:
A THREE.JS FRUIT SLICING GAME

Fruit Slash is a free Three.js 3D browser game. Swipe to slice flying fruit in half, chain combos and never cut a bomb. Built with WebGL.

· Game overview · Hosted by Indie Forge Studio

Fruit Slash: juicy 3D fruit halves and a watermelon flying apart under a glowing blade trail on a wooden board (Three.js 3D browser game)

⚒ By Indie Forge Studio

Phones: swipe to slice · Desktop: click and drag the mouse to slice · P pause · M mute

What Is Fruit Slash?

Fruit Slash is a free portrait 3D fruit slicing game for phones and desktop. Fruit is tossed up from the bottom of the screen and you swipe across it to slice it in half. Cut three or more in one swipe for a combo bonus, but never slice a bomb, and miss three fruits and the run is over. Your best score is saved on your device.

It is a Three.js game that runs as a 3D browser game on WebGL, developed by Shane Brumback and hosted by Indie Forge Studio. It is free with no download or sign-up.

How to Play Fruit Slash

  • Swipe: drag your finger (or the mouse) across the fruit to slice it.
  • Score: each fruit is worth a point; big watermelons are worth two.
  • Combo: slice 3 or more fruits in a single swipe for a combo bonus.
  • Avoid bombs: slicing a black bomb ends the run instantly.
  • Do not miss: you have 3 lives. Each fruit that falls back off the screen unsliced costs one.

Controls: Phones: swipe to slice · Desktop: click and drag the mouse to slice · P pause · M mute

How Fruit Slash Is Built with Three.js

Fruit Slash is plain JavaScript with no build step. It loads Three.js r160 as an ES module from a local copy of three.module.min.js and draws everything with a single THREE.WebGLRenderer. All the 3D models are built in code from Three.js primitives, so there are no 3D model files to download. Here is what the game code actually does:

  • Each fruit is a SphereGeometry skin with a small cone leaf. Big fruit like watermelon is stretched with mesh.scale.
  • A sliced fruit is replaced by two halves. Each half is a hemisphere (a SphereGeometry with a partial angle) capped with a CircleGeometry in the flesh color, and the halves fly apart.
  • Bombs are a glossy black sphere with a cylinder fuse and a glowing spark. Juice splashes are bursts of small spheres.
  • The blade trail is a BufferGeometry whose points are rewritten every frame from your swipe.
  • Sound effects are made on the fly with the Web Audio API (AudioContext oscillators) instead of audio files, and your best score and mute setting are stored in localStorage.

Code from Fruit Slash

These short snippets are copied straight from the game's source code.

Cutting along your swipe

For each fruit, the game finds the closest point on the latest swipe segment. If that point is inside the fruit's radius, the fruit is sliced at the swipe angle.

function cut(p) {
  if (last && core.mode === 'play') {
    const dx = p.x - last.x, dy = p.y - last.y, L2 = dx * dx + dy * dy; if (L2 < 1e-6) return;
    for (const it of S.items.slice()) {
      let t = ((it.x - last.x) * dx + (it.y - last.y) * dy) / L2; t = Math.max(0, Math.min(1, t));
      const qx = last.x + dx * t - it.x, qy = last.y + dy * t - it.y;
      if (qx * qx + qy * qy < (it.r + 0.15) ** 2) { S.items.splice(S.items.indexOf(it), 1); slice(it, Math.atan2(dy, dx)); if (core.mode !== 'play') break; }
    }
  }
  last = p; S.trail.push({ x: p.x, y: p.y, life: 0.18 });
}

From games/fruit-slash/game.js, lines 89–99

Swipe input

Pressing down starts a new stroke, and every pointermove while pressed adds a cut point.

function onAction(ev) { if (!ev) return; S.down = true; last = null; S.strokeHits = 0; cut(toWorld(ev)); }
fr.addEventListener('pointermove', (e) => { if (!S.down) return; cut(toWorld(e)); });

From games/fruit-slash/game.js, lines 100–101

Renderer setup (shared core.js)

The shared arcade core creates one WebGLRenderer, caps the pixel ratio for phones, and uses a ResizeObserver to keep the canvas and camera aspect matched to the portrait frame.

export function setupRenderer(THREE, canvas, camera, dprCap = 1.75) {
  const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, powerPreference: 'high-performance' });
  renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, dprCap));
  renderer.outputColorSpace = THREE.SRGBColorSpace;
  const frame = document.getElementById('frame');
  const resize = () => { const w = frame.clientWidth, h = frame.clientHeight; renderer.setSize(w, h, false); camera.aspect = w / h; camera.updateProjectionMatrix(); };
  new ResizeObserver(resize).observe(frame); resize();
  return renderer;
}

From games/fruit-slash/core.js, lines 67–75

Built for Mobile and Portrait Play

Fruit Slash is designed for phones held upright. The game runs in a 9:16 portrait frame, and on desktop it plays in a centered portrait frame. Input uses pointer events, so the same code handles touch and mouse, with keyboard controls on desktop.

To keep it smooth on phones, the renderer caps the device pixel ratio, and the game pauses itself when you switch tabs or apps. Phones that support it give a short vibration as feedback.

Play Fruit Slash

Free, in your browser, no download. Hosted by Indie Forge Studio.

More games: Browse all 3D games

Frequently Asked Questions

How do I play Fruit Slash?

Fruit flies up from the bottom of the screen. Swipe your finger across it, or click and drag on desktop, to slice it in half before it falls back down.

How do combos and bombs work?

Slice three or more fruits in a single swipe for bonus points. Black bombs with a lit fuse also fly up; slicing one ends the game, so swipe around them.

Is Fruit Slash free and does it work on phones?

Yes. It is free, needs no download and is built portrait-first for phones. On desktop it plays in a centered portrait frame.

Is my best score saved?

Yes. Your best score is saved in your browser with localStorage, so it is still there next time you play on the same device.

Can I turn the sound off?

Yes. Tap the speaker button or press M to mute. Your choice is remembered.

Is Fruit Slash built with Three.js?

Yes. Fruit Slash is a Three.js 3D browser game rendered with WebGL, so it runs in any modern web browser on desktop or mobile with no download or install.

Who hosts Fruit Slash?

Fruit Slash is developed by Shane Brumback and hosted by Indie Forge Studio. You can play it free on its game page.

Can I learn to make a game like this?

Yes. Browse the free Three.js tutorials.

Browse Games by Genre

Free browser games by Shane Brumback, grouped by genre: FPS, Educational, Arcade, Board game, Sport, Fantasy and Simulation. Each game keeps its release category too.

FPS Games

Educational Games

Board game Games

Sport Games

Fantasy Games

Simulation Games