logo

G

  • Tutorials
  • API
  • Examples
  • Plugins
  • Productsantv logo arrow
  • 6.1.26
  • Canvas
    • Introduction
    • Options
    • Built-in objects
    • Coordinate system
    • Scenegraph & Lifecycle
    • Event
    • OffscreenCanvas & Server-side Rendering
    • CustomElementRegistry
    • Frequently Asked Questions
  • Renderer
    • Introduction
    • Canvas Renderer
    • Canvaskit Renderer
    • SVG Renderer
    • WebGL Renderer
    • WebGPU Renderer
    • Custom Renderer
  • Camera
    • Introduction
    • Camera Parameters
    • Camera action
    • Camera animation
  • Event
    • Introduction
    • Event Object
    • Gesture & Drag'n'Drop
    • Frequently Asked Questions
  • Animation
    • Web Animations API
    • Lottie
  • Basic Shapes
    • Basic Concepts
    • DisplayObject
    • Group
    • Text
    • Circle
    • Ellipse
    • Rect
    • Image
    • Line
    • Polygon
    • Polyline
    • Path
    • HTML
  • Style System
    • Introduction
    • CSS Typed OM
    • Inheritance
    • CSS Properties & Values API
    • CSS Layout API
    • Pattern
    • Gradient
  • 3D
    • 材质
    • 几何
    • Mesh
    • 光源
    • 雾
    • 交互
  • Built-in Objects
    • EventTarget
    • Node
    • Element
    • Document
    • MutationObserver
    • Utils
  • GPGPU
    • Introduction
    • Programming Model
    • Kernel API
    • Principles of classical GPGPU implementation
    • webgpu-graph
  • Declarative programming
    • 使用 Web Components
  • Devtools
    • G 开发者工具
    • 内置的渲染统计信息
    • 第三方开发调试工具

Camera animation

Previous
Camera action
Next
Introduction

Resource

Ant Design
Galacea Effects
Umi-React Application Framework
Dumi-Component doc generator
ahooks-React Hooks Library

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference

Help

GitHub
StackOverflow

more productsMore Productions

Ant DesignAnt Design-Enterprise UI design language
yuqueYuque-Knowledge creation and Sharing tool
EggEgg-Enterprise-class Node development framework
kitchenKitchen-Sketch Tool set
GalaceanGalacean-Interactive solution
xtechLiven Experience technology
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

We can record the current position and viewpoint of the camera and save it as a Landmark, and then when the camera parameters change, you can switch to any of the previously saved Landmark at any time, with a smooth switching animation, similar to the camera pan arm on a real set, also called flyTo in some applications (e.g. Mapbox in application), example.

createLandmark

Create a Landmark with the following parameters.

  • markName
  • options Camera parameters, including.
    • position The position of the camera in the world coordinate system, taking the type reference setPosition
    • focalPoint Viewpoint in the world coordinate system, reference to the value type setFocalPoint
    • roll Rotation angle, take the value type reference setRoll
    • zoom Zoom scaling, take the value type reference setZoom
camera.createLandmark('mark1', {
position: [300, 250, 400],
focalPoint: [300, 250, 0],
});
camera.createLandmark('mark2', {
position: [300, 600, 500],
focalPoint: [300, 250, 0],
});
camera.createLandmark('mark3', {
position: [0, 250, 800],
focalPoint: [300, 250, 0],
roll: 30,
});

gotoLandmark

Switching to a previously saved Landmark works in both 2D and 3D scenes, example.

camera.gotoLandmark('mark1', { duration: 300, easing: 'ease-in' });
// or
camera.gotoLandmark(landmark, { duration: 300, easing: 'ease-in' });

The list of parameters is as follows.

  • markName
  • options Camera parameters, including.
    • duration Duration of the animation in ms, default value is 100.
    • easing Easing function, default value is linear. Consistent with the animation system built-in effects
    • easingFunction Custom easing function, when the built-in easing function can not meet the requirements, you can custom
    • onfinish Callback function at the end of the animation

As with the options parameter in the animation system, passing number is equivalent to setting duration.

camera.gotoLandmark('mark1', { duration: 300 });
camera.gotoLandmark('mark1', 300);

It is important to note that if another camera animation is called before the end of one, the animation in progress will be cancelled immediately.