Fixed Zoom
This example demonstrates a fixed focal point zoom on a phyllotaxis pattern of 2,000 points rendered on a Canvas. The d3-zoom library is used with a custom zoom transform that ignores translation values, applying only the scale factor *k* to zoom around a specified world-coordinate focal point, which is centered on the display. The code initializes the points with a phyllotaxis algorithm, using the first point as the focal reference, and redraws the scene via `context.translate` and `context.scale` based on the current transform from the `zoom` event.
AI-generated descriptionIn this example of d3-zoom, the transform’s translate x and y are ignored; only the scale k is observed, allowing zooming around a fixed focal point. The focal point in world coordinates is represented by the variables fx and fy. The view is translated such that this point appears at the middle of the display.