How to create a custom sprite [FiveM Lua] - image

I have been searching for a way to draw a custom image (.png) on screen.
When I started to look it up, I noticed everyone went for the UI way.
I've already asked how I could do this using one of FiveM's natives and I got the answer of drawSprite()
But now I have a new question; How can I create a custom sprite for the drawSprite() native to call upon?
And when I have this custom sprite, how do I use it in the drawSprite() native?
Thanks in advance!

Related

Not getting data from R3F useScroll because of zIndex

I'm trying to run an animation based on scroll in the background of a React app.
I use Threejs with React Three Fiber. In R3F, there is a hook called useScroll which I want to use.
Problem is that my Threejs scene (a Canvas) is in the background with zIndex: -100, so the scroll handler doesn't get the user input.
If I remove the zIndex property, everything works, but It's not what I want.
The scene look like this demo, the only difference is that mine has element in front.
I don't know if the solution is to use a different css style or something more complexe to allow the handler to do his job. I've been looking at React Portal but I don't think it will work.
Any ideas ?
Thanks in advance.

How to create UI for Spark AR?

I'm new to Spark AR and I'm having issues creating a UI that sticks to the screen rather than moving with the 3D object (I'm using plane tracking). Does anyone have a tutorial you followed or could tell me how to do it?
My end game is to have the user be able to switch between 3D models by touching two buttons.
Have you tried using a canvas object?
See here:
https://sparkar.facebook.com/ar-studio/learn/tutorials/2D-objects-and-layers

How to use UIVisualEffectView with Objective-C

I've been looking for documentation on how to use the UIVisualEffectView with Objective-C in iOS8.
I've seen some code examples but would appreciate the steps to use the actual view in the Object Library. This is what I tried, which had no effect:
Create a new storyboard scene
Add a UIVisualEffectView
Add a UIImageView
Add a picture to the UIImageView
I want to have a blurred picture as the background for my scenes. Can someone point me to a tutorial or provide instructions?
Thanks
I have implemented a demo which demonstrates using UIVisualEffectView with vibrancy and also with vibrancy & blur. It uses a little bit different way of implementing via storyboard so look at https://github.com/Vaberer/BlurTransition.

UI Like Youtube in Android (Tablet)

I've spent 2 hours looking for a solution. I need to make a design
like the Youtube UI (Tablet UI) where it shows a vertical scroll, but
in each row there are 4 videos (landscape view). I've tried to do
something similar, but i couldn't =(
Is there any place where i can get the source code of the youtube
application for Tablet? Or maybe some resource to solve this? :(
BTW, my try was designing UI with scrollView, LinearLayout and my_item.xml, i tried to inflate my_item.xml adding programmatically into the linearlayout (horizontal orientation), but it doesn't work in the way that i want. I need something like a linearlayout but with horizontal and vertical orientation at the same time (something like a div).
I was thinking to use a ListView and a custom adapter (with my_item.xml), but i'm not sure if this can be the best solution.
Thxs
You should create seperate resources for each layout.
For example if the user is in Portrait mode you would have the correct layout in.
layout-port: layout for portrait orientation
layout-land: layout for landscape orientation
Read more on providing alternative resources here
Also i would recommend to read more on Handling runtime changes
This will help you with recognizing when the user changes orientation. You could actually use this guide and when the user flips the devices orientation you could then change the layout. Keep in mind hard coding this can be dangerous though. I would recommend using the layout folders.
Good luck!
Finally i solve my problem.
It works with a linearLayout(vertical) and adding linearlayout(horizontal) for each row. And obviously managing my scrollview.
BTW, i still think android should have a layout like a "div".
Thxs all

Best way to animate a circle moving around a screen in Qt?

If I wanted to, using Qt, simply have some circles move around in a white box, or a graphic, what would be the best method of this?
Would I need to draw white/the graphic behind where the circle moved from every time? Is there a simple way of accomplishing this in Qt?
Create QGraphicsView object to your widget and added a QGraphicsScene to view.
Add a QGraphicsEllipseItem to scene
Use QPropertyAnimation to change the "pos" property of the ellipse item.
If you need more advanced features, you can build your own animation class on QPropertyAnimation.
enjoy it:)
Update: You can read Qt's Next Generation UI for more information.
Subclass a QWidget. Start a timerEvent() to animate the positions of the circles, then call update() at the end to schedule a repaint of the widget. Override the widget's paintEvent() - in there you draw your background and circles, using a QPainter object. The Qt Assistant has examples of how to use QPainter.
Qt also has a new animation framework that may facilitate something like this, but I have not looked into it.

Resources