Skip to content

Conversation

Copy link

Copilot AI commented Jan 7, 2026

The CityBuildingLayer circular sweep animation effect was not displaying because CityBuildModel lacked the getAnimateUniforms() method, preventing dynamic updates of the u_time uniform during the render loop.

Changes

  • Added getAnimateUniforms() method to CityBuildModel class, returning the current animation time via this.layer.getLayerAnimateTime()
  • Updated imports to include IModelUniform type from @antv/l7-core

Implementation follows the pattern used in WaterModel, OceanModel, and FillModel:

public getAnimateUniforms(): IModelUniform {
  return {
    u_time: this.layer.getLayerAnimateTime(),
  };
}

This enables the sweep animation in site/examples/gallery/animate/demo/build_sweep.js to render correctly.

Original prompt

问题描述

城市建筑图层(CityBuildingLayer)的圆形扫光动画效果丢失,扫光效果不显示。

相关 Issue: #2793

问题原因

CityBuildModel 类缺少 getAnimateUniforms() 方法的实现,导致扫光动画的 u_time uniform 变量无法在渲染循环中动态更新。虽然初始化时设置了时间值,但没有实现动态更新机制,所以扫光动画停滞不动。

其他具有动画效果的 Model 类(如 WaterModelOceanModelFillModel 等)都正确实现了此方法。

修复方案

packages/layers/src/citybuliding/models/build.ts 文件的 CityBuildModel 类中添加 getAnimateUniforms() 方法:

public getAnimateUniforms(): IModelUniform {
  return {
    u_time: this.layer.getLayerAnimateTime(),
  };
}

实现要求

  1. CityBuildModel 类中添加 getAnimateUniforms() 方法
  2. 方法应该放在 getCommonUniformsInfo() 方法之后,calCityGeo() 方法之前
  3. 确保返回类型为 IModelUniform
  4. 方法应该返回包含 u_time 属性的对象,值为 this.layer.getLayerAnimateTime()

参考实现

可以参考以下文件中的相同方法实现:

  • packages/layers/src/polygon/models/water.ts (第 48-52 行)
  • packages/layers/src/polygon/models/ocean.ts (第 50-54 行)
  • packages/layers/src/point/models/fill.ts (第 66-71 行)

测试验证

修复后,以下示例应该正常显示扫光动画效果:

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@changeset-bot
Copy link

changeset-bot bot commented Jan 7, 2026

⚠️ No Changeset found

Latest commit: 131ceae

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI changed the title [WIP] Fix missing animation effect in CityBuildingLayer Add getAnimateUniforms() to CityBuildModel to enable sweep animation Jan 7, 2026
Copilot AI requested a review from lzxue January 7, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants