2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-10-16 15:42:30 +02:00
|
|
|
title: Point.flipY()
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-29 15:54:53 +02:00
|
|
|
The `Point.flipY()` method returns a new `Point` that mirrors the original
|
|
|
|
point around the Y-value of the point you pass it. If you do not pass in a
|
|
|
|
point, it will default to mirroring around an Y-value of zero.
|
2021-10-16 15:42:30 +02:00
|
|
|
|
2022-09-29 15:54:53 +02:00
|
|
|
## Signature
|
2021-11-06 19:03:54 +01:00
|
|
|
|
2021-08-25 16:09:31 +02:00
|
|
|
```js
|
|
|
|
Point point.flipY(Point mirror = false)
|
|
|
|
```
|
|
|
|
|
2022-09-29 15:54:53 +02:00
|
|
|
## Example
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-29 15:54:53 +02:00
|
|
|
<Example caption="An example of the Point.flipY() method">
|
2021-08-25 16:09:31 +02:00
|
|
|
```js
|
2022-09-29 15:54:53 +02:00
|
|
|
({ Point, points, Path, paths, part }) => {
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-29 16:50:42 +02:00
|
|
|
points.start = new Point(0, 50)
|
|
|
|
points.churchTowerWallLeft = new Point(10, 50)
|
|
|
|
points.churchTowerRoofLeft = new Point(10, 30)
|
|
|
|
points.churchTowerTop = new Point(15, 10)
|
|
|
|
points.churchTowerRoofRight = new Point(20, 30)
|
|
|
|
points.churchRoofRight = new Point(50, 30)
|
|
|
|
points.churchWallRight = new Point(50, 50)
|
|
|
|
points.houseWallLeft = new Point(65, 50)
|
|
|
|
points.houseRoofLeft = new Point(65, 35)
|
|
|
|
points.houseRoofTop = new Point(75, 25)
|
|
|
|
points.houseRoofRight = new Point(85, 35)
|
|
|
|
points.houseWallRight = new Point(85, 50)
|
|
|
|
points.end = new Point(95, 50)
|
2022-12-30 07:47:29 -08:00
|
|
|
|
2022-09-29 16:50:42 +02:00
|
|
|
points.mirror = new Point(0, 60)
|
|
|
|
points.mirrorLineEnd = new Point(95, 60)
|
2022-12-30 07:47:29 -08:00
|
|
|
|
2022-09-29 16:50:42 +02:00
|
|
|
points._start = points.start.flipY(points.mirror)
|
|
|
|
points._churchTowerWallLeft = points.churchTowerWallLeft.flipY(points.mirror)
|
|
|
|
points._churchTowerRoofLeft = points.churchTowerRoofLeft.flipY(points.mirror)
|
|
|
|
points._churchTowerTop = points.churchTowerTop.flipY(points.mirror)
|
2022-09-29 15:54:53 +02:00
|
|
|
points._churchTowerRoofRight = points.churchTowerRoofRight.flipY(
|
|
|
|
points.mirror
|
2022-09-29 16:50:42 +02:00
|
|
|
)
|
|
|
|
points._churchRoofRight = points.churchRoofRight.flipY(points.mirror)
|
|
|
|
points._churchWallRight = points.churchWallRight.flipY(points.mirror)
|
|
|
|
points._houseWallLeft = points.houseWallLeft.flipY(points.mirror)
|
|
|
|
points._houseRoofLeft = points.houseRoofLeft.flipY(points.mirror)
|
|
|
|
points._houseRoofTop = points.houseRoofTop.flipY(points.mirror)
|
|
|
|
points._houseRoofRight = points.houseRoofRight.flipY(points.mirror)
|
|
|
|
points._houseWallRight = points.houseWallRight.flipY(points.mirror)
|
|
|
|
points._end = points.end.flipY(points.mirror)
|
2022-12-30 07:47:29 -08:00
|
|
|
|
2022-09-29 15:54:53 +02:00
|
|
|
paths.skylineTop = new Path()
|
|
|
|
.move(points.start)
|
|
|
|
.line(points.churchTowerWallLeft)
|
|
|
|
.line(points.churchTowerRoofLeft)
|
|
|
|
.line(points.churchTowerTop)
|
|
|
|
.line(points.churchTowerRoofRight)
|
|
|
|
.line(points.churchRoofRight)
|
|
|
|
.line(points.churchWallRight)
|
|
|
|
.line(points.houseWallLeft)
|
|
|
|
.line(points.houseRoofLeft)
|
|
|
|
.line(points.houseRoofTop)
|
|
|
|
.line(points.houseRoofRight)
|
|
|
|
.line(points.houseWallRight)
|
2022-09-29 16:50:42 +02:00
|
|
|
.line(points.end)
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-29 15:54:53 +02:00
|
|
|
return part
|
|
|
|
}
|
2021-08-25 16:09:31 +02:00
|
|
|
```
|
2022-09-29 15:54:53 +02:00
|
|
|
</Example>
|