Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
How Do I change color of my object every second like gradient
Print
Pages: [
1
]
Author
Topic: How Do I change color of my object every second like gradient (Read 3260 times)
0 Members and 1 Guest are viewing this topic.
rajhansk
Newbie
Posts: 21
How Do I change color of my object every second like gradient
«
on:
August 31, 2017, 08:26:35 pm »
How Do I change color of my object every second like gradient,
I have a circle and I want to change its color with every second it passes.
Which function should I use ??
Any help will be appreciated.
Thank you
Logged
Hapax
Hero Member
Posts: 3379
My number of posts is shown in hexadecimal.
Re: How Do I change color of my object every second like gradient
«
Reply #1 on:
August 31, 2017, 09:45:59 pm »
To change/set the colour of a circle (or any standard SFML shape), use:
setFillColor(sf::Color)
To animate the colour, change the colour depending on the time given by a clock (you can use
sf::Time and sf::Clock
).
For a small example of animating values smoothly depending on time, you can take a look at
this animation of the SFML logo
.
In particular, you might find most use of
this section of code
.
Logged
Selba Ward
-SFML drawables
Cheese Map
-Drawable Layered Tile Map
Kairos
-Timing Library
Grambol
*
Hapaxia Links
*
rajhansk
Newbie
Posts: 21
Re: How Do I change color of my object every second like gradient
«
Reply #2 on:
September 01, 2017, 06:28:08 am »
Thanks
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
How Do I change color of my object every second like gradient