Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Rotating an image or text in a specific point?

Asked by 6 years ago

Kinda like rotating normal bricks around a specific point but this time it's a GUI object.

If it's not possible then it's okay, I usually script things that are easy and possible to reduce development time.

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

FOR THE ANSWER, SCROLL DOWN GUI objects have a property called Rotation. In coding, you can do this:

--[[
StarterGui
-YourScreenGUI
--InstanceSuchAsAFrameTextLabelOrImage
--YourScript <<
]]

-- Code for rotation:

-- Recommended to place your script in the ScreenGui.

script.Parent.InstanceSuchAsAFrameTextLabelOrImage.Rotation = 30 -- Edit to change object's rotation.

If the specific item you want to rotate (by coding) is named as "RotateBox" and its class name is considered as a GUI object, then:

--[[
StarterGui
-RotateTest -- SCREEN GUI
--RotateBox -- GUI OBJECT
--Rotator -- SCRIPT
]]

script.Parent.RotateBox.Rotation = 45 -- Any rotation

A GUI object's rotation can also be achieved manually by going to its properties and search for the Rotation property.

EXTRA DETAILS (For better understanding about, associated with, or other uses for the GUI rotation property! :D)

  1. Rotation does not apply to objects like ScreenGui, BillboardGui, and SurfaceGui and also UI Constraints.

  2. A GUI object with children can follow their parent's rotation but not affecting their Rotation value.

  3. ClipDescendants property will not work with rotated GUI objects.

  4. If you want a GUI object to rotate smoothly via scripts, you can use the following:

-TweenService

-TweenInfo

Code:

Tween = game:GetService('TweenService') -- Gets the TweenService service

GUISCREEN = Instance.new('ScreenGui',game.StarterGui) -- Makes a new Screen Gui
TEXTBOX = Instance.new('Textbox',GUISCREEN) -- Makes a TextBox for the Screen Gui

Goal = {} -- Must be a table
Goal.Rotation = 30 -- Can be any number

Info = TweenInfo.new(3,Enum.EasingStyle.Linear,Enum.EasingDirection.In,5,true) -- More information in the link below this code.
-- To make the TextBox tween, type the following:
RotateTween = Tween:Create(TEXTBOX,Info,Goal) -- Creates a tween

RotateTween:Play() -- Plays Tween
RotateTween:Stop() -- Stops Tween
RotateTween:Cancel() -- Stops Tween and turns back the item (with the tween) back to its previous state.

For more information about TweenService, read this ROBLOX Wiki page:

http://wiki.roblox.com/index.php?title=API:Class/TweenService

For more information about TweenInfo, read this ROBLOX Wiki page:

http://wiki.roblox.com/index.php?title=TweenInfo

For more information about Tween (Class), read this ROBLOX Wiki page:

http://wiki.roblox.com/index.php?title=API:Class/Tween

( I am new here in Scripting Helpers so I have no idea how the link thingy works)

I think that's all I have.

UPDATE ANSWER

Here's a GIF file for the answer.

I apologize for the bad resolution and quality. Imgur fails to upload the file if it's HQ.

https://imgur.com/XdOrTvC

0
What about rotating GUI objects at a specific point? Like instead of rotating around it's center, it's rotated around the bottom or the top Konethorix 197 — 6y
0
I'll need some clear illustration for that. If you meant a specific point, try tweaking around with the anchor point. CrazyAceGaming0130 32 — 6y
0
I'll post the comment in the answer instead because it's easier Konethorix 197 — 6y
0
Since I'm a Lua adventurer (or a guy who is yet to discover other parts of Lua), I used a simple technique. I'll update my answer. CrazyAceGaming0130 32 — 6y
View all comments (2 more)
0
That's not how you make links, here's how: First you make a text then highlight it then click the link button and it will show (http://) and from there you can post the actual link Konethorix 197 — 6y
0
Well, I made links work now before you thought me how to, but thanks though. CrazyAceGaming0130 32 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Like in this image, I want the whole picture to rotate around the white dot on the screen (theres an arrow pointing to it)

0
Okay, let me edit my answer. I have an easy technique without using scripts (unless you need it for an animation). CrazyAceGaming0130 32 — 6y
0
Okay, let me edit my answer. I have an easy technique without using scripts (unless you need it for an animation). Just let my low-quality editor finish the GIF file. CrazyAceGaming0130 32 — 6y

Answer this question