More types of x and y values for clips

Has this feature been suggested before?
no

no, just had a random idea that suddenly popped into my head.

Describe the solution you’d like
as of now, to get/change a clip’s position, we use `clip.x` and `clip.y`. these 2 values are relative to the center of the clip.

i suddenly had an idea that if you use `clip.top`, it is identical to using `clip.y` but it is relative to the top edge of the clip instead of the middle. same concept for `clip.bottom`, `clip.left`, and `clip.right`.

this could be used to easily line a clip up on a wall without having to use extra math (basically, it hides complexity where it should really be simple).

Describe alternatives you’ve considered
using math (halving the width/height and adding/subtracting it from the coordinates) works but it’s far less intuitive.

1 Like

Do you want clip.top to return a number or a coordinate? if its a single number, then I assume that you want to associate top/bottom with Y coordinate and left/right with X coordinate…

yes, top/bottom are y coordinates (a single number) and left/right are x coordinates (also a single number). maybe there could be aliases for them that include x or y in the name. (for example, `clip.top`, `clip.topy`, `clip.top_y`, and/or `clip.topY` all do the same thing)

like…

``````get top() {
return this.y - this.height/2;
}

get bottom() {
return this.y + this.height/2;
}

get left() {
return this.x - this.width/2;
}

get right() {
return this.x + this.width/2;
}``````
1 Like

oh yeah, that is a thing.

and while i’m here, what does `get` do compared to making a function “normally”?

set / get allows you to set / get properties but you define them as functions, but the user use them as properties or variables…

Example…

get rotation() {
}

then the user only use them as:
this.angle = this.rotation; // but the user is actually calling the get rotation()

like in this example… I use them as
`if(clip.top > project.width) not as if(clip.top() > project.width)`

1 Like

I think is more complex than this as the graphic of the clip could have a center different from the clip center.
That is particulary true if you have an animation or if you change contents in a clip programmatically

1 Like