Skip to content
项目

关于

📹 A camera toolkit for the web, inspired by Unity Cinemachine.

网站与应用开发

这些数字如何统计

85 星标2 复刻 +1 24小时

实测星标增长

24小时
+1
7天
+2
15天
+9
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Klipp 📹

Version Examples Docs license

A camera toolkit for the web, inspired by Unity Cinemachine. Describe the shots you want, and Klipp picks the right one and blends between them.

The core runs anywhere, with no renderer or framework attached. Integrations are thin layers on top: three.js and React Three Fiber today, with more to come, like TresJS.

npm install @pmndrs/klipp

⚠️ Early-stage, experimental - the API may change.

Core

import { Klipp, FollowBody, HardLookAtAim, VirtualCamera, targetPose } from '@pmndrs/klipp';

const klipp = new Klipp();
const player = targetPose.create(); // keep player.position up to date

const follow = new VirtualCamera('follow', { priority: 10 });
klipp.add(follow);
follow.body = new FollowBody(player, { offset: [0, 3, 8], damping: 0.5 });
follow.aim = new HardLookAtAim(player);

// every frame
klipp.update(dt);
engineCamera.setPosition(klipp.shot.position);
engineCamera.setRotation(klipp.shot.quaternion);

React Three Fiber

import { Klipp, VirtualCamera, Body, Aim } from '@pmndrs/klipp/react';

<Klipp>
  <VirtualCamera name="follow" priority={10}>
    <Body.Follow target={playerRef} offset={[0, 3, 8]} damping={0.5} />
    <Aim.HardLookAt target={playerRef} />
  </VirtualCamera>

  <VirtualCamera name="cutscene" priority={20} active={isCutscene}>
    <Body.HardLockToTarget target={[10, 2, 0]} />
    <Aim.HardLookAt target={playerRef} />
  </VirtualCamera>
</Klipp>;

What's inside

  • Virtual cameras with priorities, and blending between them.
  • KlippControls: orbit, pan and zoom with the mouse or touch, in perspective and orthographic views.
  • Groups: play shots in a sequence, or mix several cameras by weight.
  • Body and Aim: follow, frame or look at targets, or let the user orbit and look around.
  • Extension: lens, group framing, camera offset, follow zoom, confiner and recomposer.
  • Noise and Impulse: camera shake.
  • Perspective and orthographic cameras.
  • Debugging: framing zones and camera frustums.

Packages

Entry point For
@pmndrs/klipp The core, built on math.
@pmndrs/klipp/three three.js classes, ending in Three.
@pmndrs/klipp/react React Three Fiber components.
@pmndrs/klipp/dom Mouse, touch and wheel input and debug overlays.

Links

探索相关项目

加载中…