Forum

> > CS2D > Scripts > Extending the picture between two coordinates
Forums overviewCS2D overview Scripts overviewLog in to reply

English Extending the picture between two coordinates

3 replies
To the start Previous 1 Next To the start

moved Extending the picture between two coordinates

acm
User Off Offline

Quote
Hello everyone,

I want to resize my image. Its 1x1, and I want to resize it as below picture. How can I do it with LUA?

IMG:https://i.ibb.co/BwhbN28/xc.jpg



Thanks for your help.

Edit: I have now noticed that I have opened the subject to the wrong place, I am very sorry.

Edit x2:
IMG:https://i.ibb.co/9hCYFxn/1.jpg

IMG:https://i.ibb.co/wzfMJcj/22.jpg



@user cs2d_is_a_Gem: I want to extend 1x1 png between these two coordinates as in the picture.
edited 2×, last 10.06.20 02:28:08 am

Admin/mod comment

Wrong topic section, moved. /user GeoB99

old Re: Extending the picture between two coordinates

cs2d_is_a_Gem
User Off Offline

Quote
I do not understand what you want to do, if you explain a little more, I can try to do the code.

http://www.cs2d.com/help.php?luacat=image&luacmd=image

to develop it in detail you should read that link a bit, if you put an image and move it with tween_move and adjust its size with tween_scale, you can get what you want.

this also depends on the resolution of the client so you should also use mp_hudscale
edited 2×, last 10.06.20 05:06:22 am

old Re: Extending the picture between two coordinates

Dousea
User Off Offline

Quote
I've forgotten how CS2D transformation system works. I'm assuming angle 0/360 is at 12 o'clock and the scaling origin is at the center of the image.
1
2
3
4
local rot = math.deg(math.atan2(y2-y1, x2-x1)+math.pi*0.5)
local dist = math.sqrt((x1-x2)^2 + (y1-y2)^2)
imagepos(yourimg, (x1+x2)*0.5, (y1+y2)*0.5, rot)
imagescale(yourimg, 1, dist)
Or something like that.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview